Programmatically make and receive calls using PJSIP via a PBX?

SR
Sonny Rajagopalan
Thu, Feb 18, 2016 8:48 PM

Hello,

I am trying to use the PJSUA binary to register with a SIP PBX (that uses
SIP over TCP), and I try this (compiled correctly in Linux 3.x/64 bit):

${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu
--id sip:extension@<PublicIPAddressOFPBX> --registrar
sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly
--password sillerpassword

And when I see the logs, it still tries to connect at the UDP port of the
PBX:

pjsua_core.c  .TX 557 bytes Request msg REGISTER/cseq=27042 (tdta0xdc86a0)
to UDP <PublicIPAddressOFPBX>:5060:

However, at least, I see that PJSUA doesn't crash; it lands me at the
pretty ASCII prompt that gives me the various options but mentions I am
unregistered.

As a result, I am not able to register with the PBX.

I pointed to another PBX which does UDP based SIP and then tried this:

${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu
--id sip:extension@<PublicIPAddressOfUDPPBX> --registrar
sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password
sillerpassword

Which doesn't work due to

pjsua_app_conf  Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu

In this case, however, no pretty ASCII prompt, and my pjsua program exits
out completely.

Can someone tell me what I am doing wrong? I am using the instructions in
http://www.pjsip.org/pjsua.htm

Very confusingly, I tried the TCP based method (using ;transport=tcp) with
the UDP client, and that looked like it was trying to register, but didn't
respond to the (correct) 401 Unauthorized (and landed me on the pretty
ASCII prompt. At that point, I did

rr --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar

sip:<PublicIPAddressOfUDPPBX>;transport=tcp --realm * --username silly
--password sillerpassword

And this seems to have worked (status on pjsip show endpoints on PBX).

Is there a less clunkier way of doing all of this? The pjsua app certainly
looks broken to me. Is it? If so, are there any alternatives?

Thanks,
Sonny.

Hello, I am trying to use the PJSUA binary to register with a SIP PBX (that uses SIP over TCP), and I try this (compiled correctly in Linux 3.x/64 bit): ${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu --id sip:extension@<PublicIPAddressOFPBX> --registrar sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly --password sillerpassword And when I see the logs, it still tries to connect at the UDP port of the PBX: pjsua_core.c .TX 557 bytes Request msg REGISTER/cseq=27042 (tdta0xdc86a0) to UDP <PublicIPAddressOFPBX>:5060: However, at least, I see that PJSUA doesn't crash; it lands me at the pretty ASCII prompt that gives me the various options but mentions I am unregistered. As a result, I am not able to register with the PBX. I pointed to another PBX which does UDP based SIP and then tried this: ${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password sillerpassword Which doesn't work due to pjsua_app_conf Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu In this case, however, no pretty ASCII prompt, and my pjsua program exits out completely. Can someone tell me what I am doing wrong? I am using the instructions in http://www.pjsip.org/pjsua.htm Very confusingly, I tried the TCP based method (using ;transport=tcp) with the UDP client, and that looked like it was trying to register, but didn't respond to the (correct) 401 Unauthorized (and landed me on the pretty ASCII prompt. At that point, I did >> rr --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar sip:<PublicIPAddressOfUDPPBX>;transport=tcp --realm * --username silly --password sillerpassword And this seems to have worked (status on pjsip show endpoints on PBX). Is there a less clunkier way of doing all of this? The pjsua app certainly looks broken to me. Is it? If so, are there any alternatives? Thanks, Sonny.
GJ
George Joseph
Thu, Feb 18, 2016 9:27 PM

On Thu, Feb 18, 2016 at 1:48 PM, Sonny Rajagopalan <
sonny.rajagopalan@gmail.com> wrote:

Hello,

I am trying to use the PJSUA binary to register with a SIP PBX (that uses
SIP over TCP), and I try this (compiled correctly in Linux 3.x/64 bit):

${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu
--id sip:extension@<PublicIPAddressOFPBX> --registrar
sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly
--password sillerpassword

And when I see the logs, it still tries to connect at the UDP port of the
PBX:

pjsua_core.c  .TX 557 bytes Request msg REGISTER/cseq=27042 (tdta0xdc86a0)
to UDP <PublicIPAddressOFPBX>:5060:

However, at least, I see that PJSUA doesn't crash; it lands me at the
pretty ASCII prompt that gives me the various options but mentions I am
unregistered.

As a result, I am not able to register with the PBX.

I pointed to another PBX which does UDP based SIP and then tried this:

${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu
--id sip:extension@<PublicIPAddressOfUDPPBX> --registrar
sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password
sillerpassword

Which doesn't work due to

pjsua_app_conf  Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu

In this case, however, no pretty ASCII prompt, and my pjsua program exits
out completely.

Can someone tell me what I am doing wrong? I am using the instructions in
http://www.pjsip.org/pjsua.htm

Very confusingly, I tried the TCP based method (using ;transport=tcp) with
the UDP client, and that looked like it was trying to register, but didn't
respond to the (correct) 401 Unauthorized (and landed me on the pretty
ASCII prompt. At that point, I did

rr --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar

sip:<PublicIPAddressOfUDPPBX>;transport=tcp --realm * --username silly
--password sillerpassword

And this seems to have worked (status on pjsip show endpoints on PBX).

Is there a less clunkier way of doing all of this? The pjsua app certainly
looks broken to me. Is it? If so, are there any alternatives?

​sipp is probably a better alternative.  Although the Asterisk TestSuite
uses pjsua in a few places, the majority of the tests use sipp.

On Thu, Feb 18, 2016 at 1:48 PM, Sonny Rajagopalan < sonny.rajagopalan@gmail.com> wrote: > Hello, > > I am trying to use the PJSUA binary to register with a SIP PBX (that uses > SIP over TCP), and I try this (compiled correctly in Linux 3.x/64 bit): > > ${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu > --id sip:extension@<PublicIPAddressOFPBX> --registrar > sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly > --password sillerpassword > > And when I see the logs, it still tries to connect at the UDP port of the > PBX: > > pjsua_core.c .TX 557 bytes Request msg REGISTER/cseq=27042 (tdta0xdc86a0) > to UDP <PublicIPAddressOFPBX>:5060: > > However, at least, I see that PJSUA doesn't crash; it lands me at the > pretty ASCII prompt that gives me the various options but mentions I am > unregistered. > > As a result, I am not able to register with the PBX. > > I pointed to another PBX which does UDP based SIP and then tried this: > > ${pjproject-2.4.5-home}/pjsip-apps/bin$ ./pjsua-x86_64-unknown-linux-gnu > --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar > sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password > sillerpassword > > Which doesn't work due to > > pjsua_app_conf Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu > > In this case, however, no pretty ASCII prompt, and my pjsua program exits > out completely. > > Can someone tell me what I am doing wrong? I am using the instructions in > http://www.pjsip.org/pjsua.htm > > Very confusingly, I tried the TCP based method (using ;transport=tcp) with > the UDP client, and that looked like it was trying to register, but didn't > respond to the (correct) 401 Unauthorized (and landed me on the pretty > ASCII prompt. At that point, I did > > >> rr --id sip:extension@<PublicIPAddressOfUDPPBX> --registrar > sip:<PublicIPAddressOfUDPPBX>;transport=tcp --realm * --username silly > --password sillerpassword > > And this seems to have worked (status on pjsip show endpoints on PBX). > > Is there a less clunkier way of doing all of this? The pjsua app certainly > looks broken to me. Is it? If so, are there any alternatives? > ​sipp is probably a better alternative. Although the Asterisk TestSuite uses pjsua in a few places, the majority of the tests use sipp. > > > Thanks, > Sonny. > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
L
lameventanas@gmail.com
Mon, Mar 7, 2016 11:47 AM

On 2016-02-19 05:48, Sonny Rajagopalan wrote:

Hello,

I am trying to use the PJSUA binary to register with a SIP PBX (that
uses SIP over TCP), and I try this (compiled correctly in Linux 3.x/64
bit):

${pjproject-2.4.5-home}/pjsip-apps/bin$
./pjsua-x86_64-unknown-linux-gnu --id
sip:extension@<PublicIPAddressOFPBX> --registrar
sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly
--password sillerpassword

Don't forget to escape the ";" and "*" characters, otherwise your shell
will do something unexpected.

I pointed to another PBX which does UDP based SIP and then tried this:

${pjproject-2.4.5-home}/pjsip-apps/bin$
./pjsua-x86_64-unknown-linux-gnu --id
sip:extension@<PublicIPAddressOfUDPPBX> --registrar
sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password
sillerpassword

Which doesn't work due to

pjsua_app_conf  Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu

In this case, however, no pretty ASCII prompt, and my pjsua program
exits out completely.

Can someone tell me what I am doing wrong? I am using the instructions
in http://www.pjsip.org/pjsua.htm

I use these arguments and it works well for me:
--id sip:<user>@<server> --registrar sip:<server> --username <user>
--password <password> --realm *

Is there a less clunkier way of doing all of this? The pjsua app
certainly looks broken to me. Is it? If so, are there any alternatives?

You could use the --config-file argument and save all your arguments to
a text file.
Its contents could be something like:
--log-level 5
--app-log-level 4
--local-port 5601
--id sip:01@example.com
--registrar sip:example.com;transport=tcp
--username 01
--password secret
--realm *
--video
--auto-answer 500

You get the idea.

On 2016-02-19 05:48, Sonny Rajagopalan wrote: > Hello, > > I am trying to use the PJSUA binary to register with a SIP PBX (that > uses SIP over TCP), and I try this (compiled correctly in Linux 3.x/64 > bit): > > ${pjproject-2.4.5-home}/pjsip-apps/bin$ > ./pjsua-x86_64-unknown-linux-gnu --id > sip:extension@<PublicIPAddressOFPBX> --registrar > sip:<PublicIPAddressOFPBX>;transport=tcp --realm * --username silly > --password sillerpassword Don't forget to escape the ";" and "*" characters, otherwise your shell will do something unexpected. > I pointed to another PBX which does UDP based SIP and then tried this: > > ${pjproject-2.4.5-home}/pjsip-apps/bin$ > ./pjsua-x86_64-unknown-linux-gnu --id > sip:extension@<PublicIPAddressOfUDPPBX> --registrar > sip:<PublicIPAddressOfUDPPBX> --realm * --username silly --password > sillerpassword > > Which doesn't work due to > > pjsua_app_conf Invalid SIP URI pjsystest-x86_64-unknown-linux-gnu > > In this case, however, no pretty ASCII prompt, and my pjsua program > exits out completely. > > Can someone tell me what I am doing wrong? I am using the instructions > in http://www.pjsip.org/pjsua.htm > I use these arguments and it works well for me: --id sip:<user>@<server> --registrar sip:<server> --username <user> --password <password> --realm * > > Is there a less clunkier way of doing all of this? The pjsua app > certainly looks broken to me. Is it? If so, are there any alternatives? > You could use the --config-file argument and save all your arguments to a text file. Its contents could be something like: --log-level 5 --app-log-level 4 --local-port 5601 --id sip:01@example.com --registrar sip:example.com;transport=tcp --username 01 --password secret --realm * --video --auto-answer 500 You get the idea.