[pjsip] How to make a loopback video call with AVI file?

Ken Resander kresander at yahoo.com
Mon Jul 23 17:43:00 EDT 2012


I am trying to learn how to use pjsip with video with pjsip 2.0.1.

I don't have a peer/partner to send to so need to use loopback on the PC that runs Ubuntu 10.04 LTS. I am using pjsua like this:

   pjsua --play-avi=Path_avi_file sip:127.0.0.1

but it is not doing what I imagined it would do.

The avi file atworkpcmmulaw8000.avi contains:
  video:  320x240 ffmpeg mpeg-4 30fps
  audio:  PCM mulaw mono sampling rate 8000

 I converted this from a wmv file found at http://www.funny-games.biz/videos/ in section Office Videos under Bored at Work by the ffmpeg utility. There are details about this in another thread 'Cannot get AVI file to play on pjsip 2.0.1' that I will go back to later.

Running the command-line command produced a ringtone, but there were points before the ring that I could not understand.

1.  I have read PCM mulaw at 8000Hz is widely supported, but the following lines:

"18:09:52.335   avi_player.c  Unsupported audio stream
18:09:52.335   avi_player.c  AVI file player '/home/ken/pjs201c/pjproject-2.0.1/pjsip-apps/bin/atworkpcmmulaw8000.avi' created with 1 media ports
18:09:52.339    pjsua_app.c  AVI player atworkpcmmulaw8000.avi created, dev_id=2
18:09:52.339    pjsua_app.c  AVI atworkpcmmulaw8000.avi: audio ignored, format=MPG4"

seem to indicate it is not supported. Also I am puzzled by 'audio ignored, format=MPG4' since I did not request mpg4 when converting the audio from wmv to avi.


2.  The sip INVITE contains SDP that bears no relationship to the audio in the AVI file given in --play-avi option. I imagined pjsip would inspect the avi header and build a corresponding SDP offer because that is what the offerer has got to offer. Can I tell the SIP INVITE to build SDP using the codec info in the avi file from the command-line? Or more generally, how to specify what goes into the SDP part from the command line?

3.  Why is the port 0 for video media (video 0 RTP/AVP 31)? since video is needed...

4.  Immediately after the UI menu is a message "You have 2 active calls".
    Why is this? since I have only made one call...

5.  a bit further down I can see the message "No pending calls", but I expected
    one since it was ringing. I tried command-letter a to answer the call, but this
    did not have any effect. So quit (q) at this point.

6.  I also tried some other wmv-to-avi conversions. For example, h.263 for
    video and audio pcm_s16le, mono,8000hz. Then both video and audio
    were reported as not supported. Also mystified by this.

I really need to understand this a bit better. Hoping for advice.

Ken

P.S.   Here is the console log (probably longer than it needs to be, but could not decide what to leave out):

ken at meijin-desktop:~$ ./pjs201c/pjproject-2.0.1/pjsip-apps/bin/pjsua-i686-pc-linux-gnu --play-avi=/home/ken/pjs201c/pjproject-2.0.1/pjsip-apps/bin/atworkpcmmulaw8000.avi sip:127.0.0.1
18:09:52.129 os_core_unix.c !pjlib 2.0.1 for POSIX initialized
18:09:52.131 sip_endpoint.c  .Creating endpoint instance...
18:09:52.131          pjlib  .select() I/O Queue created (0xa046170)
18:09:52.131 sip_endpoint.c  .Module "mod-msg-print" registered
18:09:52.131 sip_transport.  .Transport manager created.
18:09:52.131   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
18:09:52.131 sip_endpoint.c  .Module "mod-pjsua-log" registered
18:09:52.131 sip_endpoint.c  .Module "mod-tsx-layer" registered
18:09:52.131 sip_endpoint.c  .Module "mod-stateful-util" registered
18:09:52.131 sip_endpoint.c  .Module "mod-ua" registered
18:09:52.131 sip_endpoint.c  .Module "mod-100rel" registered
18:09:52.131 sip_endpoint.c  .Module "mod-pjsua" registered
18:09:52.132 sip_endpoint.c  .Module "mod-invite" registered
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
18:09:52.207       pa_dev.c  ..PortAudio sound library initialized, status=0
18:09:52.207       pa_dev.c  ..PortAudio host api count=2
18:09:52.207       pa_dev.c  ..Sound device count=10
18:09:52.207          pjlib  ..select() I/O Queue created (0xa065bd4)
18:09:52.256    pjsua_vid.c  ..Initializing video subsystem..
18:09:52.258 ffmpeg_vid_cod  ...Cannot find H264 encoder in ffmpeg library
18:09:52.258 colorbar_dev.c  ...Colorbar video src initialized with 1 device(s):
18:09:52.258 colorbar_dev.c  ... 0: Colorbar generator
18:09:52.335      sdl_dev.c  ...SDL 2.0 initialized
18:09:52.335 sip_endpoint.c  .Module "mod-evsub" registered
18:09:52.335 sip_endpoint.c  .Module "mod-presence" registered
18:09:52.335 sip_endpoint.c  .Module "mod-mwi" registered
18:09:52.335 sip_endpoint.c  .Module "mod-refer" registered
18:09:52.335 sip_endpoint.c  .Module "mod-pjsua-pres" registered
18:09:52.335 sip_endpoint.c  .Module "mod-pjsua-im" registered
18:09:52.335 sip_endpoint.c  .Module "mod-pjsua-options" registered
18:09:52.335   pjsua_core.c  .1 SIP worker threads created
18:09:52.335   pjsua_core.c  .pjsua version 2.0.1 for Linux-2.6.32.41/i686/glibc-2.11 initialized
18:09:52.335   pjsua_core.c  .PJSUA state changed: CREATED --> INIT
18:09:52.335 sip_endpoint.c  Module "mod-default-handler" registered
18:09:52.335      avi_dev.c  AVI dev factory created with 1 virtual device(s)
18:09:52.335   avi_player.c  Unsupported audio stream
18:09:52.335   avi_player.c  AVI file player '/home/ken/pjs201c/pjproject-2.0.1/pjsip-apps/bin/atworkpcmmulaw8000.avi' created with 1 media ports
18:09:52.339    pjsua_app.c  AVI player atworkpcmmulaw8000.avi created, dev_id=2
18:09:52.339    pjsua_app.c  AVI atworkpcmmulaw8000.avi: audio ignored, format=MPG4
18:09:52.340   pjsua_core.c  SIP UDP socket reachable at 192.168.0.2:5060
18:09:52.340   udp0xa097190  SIP UDP transport started, published address is 192.168.0.2:5060
18:09:52.340    pjsua_acc.c  Adding account: id=<sip:192.168.0.2:5060>
18:09:52.340    pjsua_acc.c  .Account <sip:192.168.0.2:5060> added with id 0
18:09:52.340    pjsua_acc.c  Modifying accunt 0
18:09:52.340    pjsua_acc.c  Acc 0: setting online status to 1..
18:09:52.341    tcplis:5060  SIP TCP listener ready for incoming connections at 192.168.0.2:5060
18:09:52.341    pjsua_acc.c  Adding account: id=<sip:192.168.0.2:5060;transport=TCP>
18:09:52.341    pjsua_acc.c  .Account <sip:192.168.0.2:5060;transport=TCP> added with id 1
18:09:52.341    pjsua_acc.c  Modifying accunt 1
18:09:52.341    pjsua_acc.c  Acc 1: setting online status to 1..
18:09:52.341   pjsua_pres.c  Adding buddy: sip:127.0.0.1
18:09:52.341   pjsua_pres.c  .Buddy 0 added.
18:09:52.341   pjsua_pres.c  .Buddy 0: unsubscribing presence..
18:09:52.341   pjsua_pres.c  ..Buddy 0: updating presence..
18:09:52.341   pjsua_core.c  PJSUA state changed: INIT --> STARTING
18:09:52.341  pjsua_media.c  ..NAT type detection failed: Invalid STUN server or server not configured (PJNATH_ESTUNINSERVER)
18:09:52.341 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
18:09:52.341   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
18:09:52.341   pjsua_call.c  Making call with acc #1 to sip:127.0.0.1
18:09:52.341    pjsua_aud.c  .Set sound device: capture=-1, playback=-2
18:09:52.341    pjsua_app.c  ..Turning sound device ON
18:09:52.341    pjsua_aud.c  ..Opening sound device PCM at 16000/1/20ms
18:09:52.343    ec0xa0cd710  ...AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=100 ms
18:09:52.344  pjsua_media.c  .Call 0: initializing media..
18:09:52.344  pjsua_media.c  ..RTP socket reachable at 192.168.0.2:40000
18:09:52.344  pjsua_media.c  ..RTCP socket reachable at 192.168.0.2:40001
18:09:52.344  pjsua_media.c  ..Media index 0 selected for audio call 0
18:09:52.345   pjsua_core.c  ....TX 1143 bytes Request msg INVITE/cseq=13130 (tdta0xa405f50) to UDP 127.0.0.1:5060:
INVITE sip:127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.2:5060;rport;branch=z9hG4bKPjM3Mn9WGWMnuOlV0hECET2CdjJO9wwcnj
Max-Forwards: 70
From: <sip:192.168.0.2>;tag=b3RASfiSqIt0AK-539TOy5knYThvfBI9
To: sip:127.0.0.1
Contact: <sip:192.168.0.2:5060;ob>
Call-ID: 3NhUYiNvyKOQFk-Jm4IP6TYCZIOgyKXw
CSeq: 13130 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: PJSUA v2.0.1 Linux-2.6.32.41/i686/glibc-2.11
Content-Type: application/sdp
Content-Length:   536

v=0
o=- 3552052192 3552052192 IN IP4 192.168.0.2
s=pjmedia
c=IN IP4 192.168.0.2
b=AS:84
t=0 0
a=X-nat:0
m=audio 40000 RTP/AVP 98 97 99 104 3 0 8 9 96
c=IN IP4 192.168.0.2
b=TIAS:64000
a=rtcp:40001 IN IP4 192.168.0.2
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:104 iLBC/8000
a=fmtp:104 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
m=video 0 RTP/AVP 31
c=IN IP4 127.0.0.1

--end msg--
18:09:52.345   pjsua_core.c  .RX 1143 bytes Request msg INVITE/cseq=13130 (rdata0xa0c86a4) from UDP 127.0.0.1:5060:
INVITE sip:127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.2:5060;rport;branch=z9hG4bKPjM3Mn9WGWMnuOlV0hECET2CdjJO9wwcnj
Max-Forwards: 70
From: <sip:192.168.0.2>;tag=b3RASfiSqIt0AK-539TOy5knYThvfBI9
To: sip:127.0.0.1
Contact: <sip:192.168.0.2:5060;ob>
Call-ID: 3NhUYiNvyKOQFk-Jm4IP6TYCZIOgyKXw
CSeq: 13130 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
User-Agent: PJSUA v2.0.1 Linux-2.6.32.41/i686/glibc-2.11
Content-Type: application/sdp
Content-Length:   536

v=0
o=- 3552052192 3552052192 IN IP4 192.168.0.2
s=pjmedia
c=IN IP4 192.168.0.2
b=AS:84
t=0 0
a=X-nat:0
m=audio 40000 RTP/AVP 98 97 99 104 3 0 8 9 96
c=IN IP4 192.168.0.2
b=TIAS:64000
a=rtcp:40001 IN IP4 192.168.0.2
a=sendrecv
a=rtpmap:98 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:99 speex/32000
a=rtpmap:104 iLBC/8000
a=fmtp:104 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
m=video 0 RTP/AVP 31
c=IN IP4 127.0.0.1

--end msg--
18:09:52.345    pjsua_app.c  .......Call 0 state changed to CALLING
18:09:52.345   pjsua_call.c !.Incoming Request msg INVITE/cseq=13130 (rdata0xa0c86a4)
18:09:52.346  pjsua_media.c  ..Call 1: initializing media..
18:09:52.346  pjsua_media.c  ...RTP socket reachable at 192.168.0.2:40002
18:09:52.346  pjsua_media.c  ...RTCP socket reachable at 192.168.0.2:40003
18:09:52.346  pjsua_media.c  ...Media index 0 selected for audio call 1
18:09:52.347   pjsua_core.c  .....TX 302 bytes Response msg 100/INVITE/cseq=13130 (tdta0xa415790) to UDP 127.0.0.1:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.2:5060;rport=5060;received=127.0.0.1;branch=z9hG4bKPjM3Mn9WGWMnuOlV0hECET2CdjJO9wwcnj
Call-ID: 3NhUYiNvyKOQFk-Jm4IP6TYCZIOgyKXw
From: <sip:192.168.0.2>;tag=b3RASfiSqIt0AK-539TOy5knYThvfBI9
To: <sip:127.0.0.1>
CSeq: 13130 INVITE
Content-Length:  0


--end msg--
18:09:52.347    pjsua_aud.c  ..Conf connect: 2 --> 0
18:09:52.347   conference.c  ...Port 2 (ring) transmitting to port 0 (Intel 82801DB-ICH4: Intel 82801DB-ICH4 (hw:0,0))
18:09:52.347    pjsua_app.c  ..Incoming call for account 0!
Media count: 1 audio & 0 video
From: <sip:192.168.0.2>
To: <sip:127.0.0.1>
Press a to answer or h to reject call
18:09:52.347   pjsua_core.c  .RX 302 bytes Response msg 100/INVITE/cseq=13130 (rdata0xa0c86a4) from UDP 127.0.0.1:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.2:5060;rport=5060;received=127.0.0.1;branch=z9hG4bKPjM3Mn9WGWMnuOlV0hECET2CdjJO9wwcnj
Call-ID: 3NhUYiNvyKOQFk-Jm4IP6TYCZIOgyKXw
From: <sip:192.168.0.2>;tag=b3RASfiSqIt0AK-539TOy5knYThvfBI9
To: <sip:127.0.0.1>
CSeq: 13130 INVITE
Content-Length:  0


--end msg--
>>>>
Account list:
  [ 0] <sip:192.168.0.2:5060>: does not register
       Online status: Online
 *[ 1] <sip:192.168.0.2:5060;transport=TCP>: does not register
       Online status: Online
Buddy list:
 [ 1] <?>  sip:127.0.0.1

+=============================================================================+
|       Call Commands:         |   Buddy, IM & Presence:  |     Account:      |
|                              |                          |                   |
|  m  Make new call            | +b  Add new buddy       .| +a  Add new accnt |
|  M  Make multiple calls      | -b  Delete buddy         | -a  Delete accnt. |
|  a  Answer call              |  i  Send IM              | !a  Modify accnt. |
|  h  Hangup call  (ha=all)    |  s  Subscribe presence   | rr  (Re-)register |
|  H  Hold call                |  u  Unsubscribe presence | ru  Unregister    |
|  v  re-inVite (release hold) |  t  ToGgle Online status |  >  Cycle next ac.|
|  U  send UPDATE              |  T  Set online status    |  <  Cycle prev ac.|
| ],[ Select next/prev call    +--------------------------+-------------------+
|  x  Xfer call                |      Media Commands:     |  Status & Config: |
|  X  Xfer with Replaces       |                          |                   |
|  #  Send RFC 2833 DTMF       | cl  List ports           |  d  Dump status   |
|  *  Send DTMF with INFO      | cc  Connect port         | dd  Dump detailed |
| dq  Dump curr. call quality  | cd  Disconnect port      | dc  Dump config   |
|                              |  V  Adjust audio Volume  |  f  Save config   |
|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |                   |
+-----------------------------------------------------------------------------+
| Video: "vid help" for more info                                             |
+-----------------------------------------------------------------------------+
|  q  QUIT   L  ReLoad   sleep MS   echo [0|1|txt]     n: detect NAT type     |
+=============================================================================+
You have 2 active calls
Current call id=0 to sip:127.0.0.1 [CALLING]
>>> 18:09:52.364 os_core_unix.c  Info: possibly re-registering existing thread
a
No pending incoming call
>>> q
18:10:03.453   pjsua_core.c !Shutting down, flags=0...
18:10:03.453   pjsua_core.c  PJSUA state changed: RUNNING --> CLOSING
..... rest omitted

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120723/98a3d313/attachment-0001.html>


More information about the pjsip mailing list