Sonetel pjsip convertion

Hello, I try to convert our currently working sonetel chan_sip connection to pjsip.

Incoming:

USER Context: [email protected]

type=friend
secret=asdasdasdasd
registertimeout=600
qualifyfreq=600
qualify=yes
nat=yes
host=sip.sonetel.com
fromdomain=sip.sonetel.com
disallow=all
context=from-trunk
allow=ulaw&alaw&g722&gsm

Register String: [email protected]:[email protected]

Outgoing:

username=asterisk
type=friend
secret=asdasdasdasd-x
remotesecret=asdasdasdasd-x
registertimeout=660
qualifyfreq=600
qualify=yes
outboundproxy=sip.sonetel.com
nat=yes
insecure=port,invite
host=sip.sonetel.com
fromuser=asterisk123
fromdomain=domain.com
dtmfmode=rfc2833
disallow=All
allow=alaw&ulaw&gsm

I think my main problem is the registration string. I have no idea how to convert [email protected]:[email protected] to something that pjsip understands (isn’t working without either) res_pjsip_outbound_registration.c: '404' fatal response received from 'sip:sip.sonetel.com:5060' on registration attempt to .

For the [email protected] part I found no way of converting because @ is not allowed res_pjsip/pjsip_configuration.c: Error configuring endpoint 'sonetel' - 'from_user' field contains invalid character '@':slight_smile:

Already tried the typical combinations and also followed https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip#Migratingfromchan_siptores_pjsip-ExampleSIPTrunkConfiguration but it looks like sonetel wants [email protected].

Tried again some variations, if I put just “[email protected]” at the username and basically empty config it shows a different error

res_pjsip_outbound_registration.c: Invalid client URI 'sip:[email protected]@sip.sonetel.com:5060' specified on outbound registration 'sonetel'
res_sorcery_config.c: Could not create an object of type 'registration' with id 'sonetel' from configuration file 'pjsip.conf'

manually entering the client uri didn’t worked either with the same error message

sip:[email protected]@sip.sonetel.com:5060
sip:"[email protected]"@sip.sonetel.com:5060
sip:asterisk123\ @domain.com@sip.sonetel.com:5060

Your username isn’t "[email protected]". Your username is asterisk123, for domain domain.com using outbound proxy sip.sonetel.com

I don’t know how that maps into FreePBX configuration but in pure Asterisk it would be possible. For outbound registration I think it would map to something like:

[mytrunk]
type=registration
outbound_auth=mytrunk
server_uri=sip:domain.com
client_uri=sip:[email protected]
outbound_proxy=sip:sip.sonetel.com

Which means “send REGISTER to sip.sonetel.com telling it to go to domain domain.com and register to account asterisk123”. That’s just a rough guess, never heard of this provider before or know the details.

For endpoint it would be similar.

[mytrunk]
type=endpoint
from_user=asterisk123
from_domain=domain.com
outbound_proxy=sip:sip.sonetel.com

[mytrunk]
type=aor
contact=sip:domain.com
outbound_proxy=sip:sip.sonetel.com

sorry for late reply

First tx for help registrations seem to work (shown at Asterisk and Sonetel online interface).
Sadly it still redirects to the fallback number, can’t rule out if this is a Sonetel problem (I`ll ask their support).

Same situation at the outbound call, log looks okay (beside that line) but the call never reaches the target number.

app_stack.c: Spawn extension (from-pstn, 000491234567891, 1) exited non-zero on 'PJSIP/sonetel-0000b807'
pbx.c: Executing [s@macro-dialout-trunk:27] Dial("PJSIP/1234-0000b806", "PJSIP/00491234567891@sonetel,300,Ttb(func-apply-sipheaders^s^1,(6))U(sub-send-obroute-email^00491234567891^000491234567891^6^1234567891^04123456789^05123456789)") in new stack
app_stack.c: PJSIP/sonetel-0000b807 Internal Gosub(func-apply-sipheaders,s,1(6)) start
pbx.c: Executing [s@func-apply-sipheaders:1] NoOp("PJSIP/sonetel-0000b807", "Applying SIP Headers to channel PJSIP/sonetel-0000b807") in new stack
pbx.c: Executing [s@func-apply-sipheaders:2] Set("PJSIP/sonetel-0000b807", "TECH=PJSIP") in new stack
pbx.c: Executing [s@func-apply-sipheaders:3] Set("PJSIP/sonetel-0000b807", "SIPHEADERKEYS=Alert-Info") in new stack
pbx.c: Executing [s@func-apply-sipheaders:4] While("PJSIP/sonetel-0000b807", "1") in new stack
pbx.c: Executing [s@func-apply-sipheaders:5] Set("PJSIP/sonetel-0000b807", "sipheader=unset") in new stack
pbx.c: Executing [s@func-apply-sipheaders:6] ExecIf("PJSIP/sonetel-0000b807", "1?Set(PJSIP_HEADER(remove,Alert-Info)=)") in new stack
pbx.c: Executing [s@func-apply-sipheaders:7] ExecIf("PJSIP/sonetel-0000b807", "0?Set(sipheader=<http://127.0.0.1>;info=unset)") in new stack
pbx.c: Executing [s@func-apply-sipheaders:8] ExecIf("PJSIP/sonetel-0000b807", "0?Set(sipheader=<http://127.0.0.1>unset)") in new stack
pbx.c: Executing [s@func-apply-sipheaders:9] ExecIf("PJSIP/sonetel-0000b807", "0?Set(PJSIP_HEADER(add,Alert-Info)=unset)") in new stack
pbx.c: Executing [s@func-apply-sipheaders:10] EndWhile("PJSIP/sonetel-0000b807", "") in new stack
pbx.c: Executing [s@func-apply-sipheaders:4] While("PJSIP/sonetel-0000b807", "0") in new stack
pbx.c: Executing [s@func-apply-sipheaders:11] Return("PJSIP/sonetel-0000b807", "") in new stack
app_stack.c: Spawn extension (from-pstn, 000491234567891, 1) exited non-zero on 'PJSIP/sonetel-0000b807'
app_stack.c: PJSIP/sonetel-0000b807 Internal Gosub(func-apply-sipheaders,s,1(6)) complete GOSUB_RETVAL=
app_dial.c: Called PJSIP/00491234567891@sonetel
... 30sec ...
app_macro.c: Spawn extension (macro-dialout-trunk, s, 27) exited non-zero on 'PJSIP/1234-0000b806' in macro 'dialout-trunk'
pbx.c: Spawn extension (from-internal, 000491234567891, 12) exited non-zero on 'PJSIP/1234-0000b806'
pbx.c: Executing [h@from-internal:1] Macro("PJSIP/1234-0000b806", "hangupcall") in new stack
pbx.c: Executing [s@macro-hangupcall:1] GotoIf("PJSIP/1234-0000b806", "1?theend") in new stack
pbx_builtins.c: Goto (macro-hangupcall,s,3)
pbx.c: Executing [s@macro-hangupcall:3] ExecIf("PJSIP/1234-0000b806", "0?Set(CDR(recordingfile)=)") in new stack
pbx.c: Executing [s@macro-hangupcall:4] NoOp("PJSIP/1234-0000b806", "PJSIP/sonetel-0000b807 montior file= ") in new stack
pbx.c: Executing [s@macro-hangupcall:5] GotoIf("PJSIP/1234-0000b806", "1?skipagi") in new stack
pbx_builtins.c: Goto (macro-hangupcall,s,7)
pbx.c: Executing [s@macro-hangupcall:7] Hangup("PJSIP/1234-0000b806", "") in new stack
app_macro.c: Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'PJSIP/1234-0000b806' in macro 'hangupcall'
pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/1234-0000b806'

This log is not useful because it does not include a SIP trace.

At the Asterisk command prompt, type
pjsip set logger on
make another test call, paste the Asterisk log for the call (not the console output) at pastebin.freepbx.org and post the link here.

Also post your trunk settings and confirm that registration is successful.

hopefully this is everything (taken from a fully running system)
https://pastebin.freepbx.org/view/8aacf947

[root@asterisk ~]# asterisk -rx "pjsip show registrations" 
 <Registration/ServerURI..............................>  <Auth..........>  <Status.......>
==========================================================================================
 sonetel/sip:domain.com                                 sonetel       Registered

sone1
sone2

placeholder asterisk123 and domain.com are replaced with the real login

The log cuts off at line 150, so we can’t see the error response from Sonetel, which is likely useful.

However, I see a few strange things:

For Outbound Proxy, try
sip:sip.sonetel.com\;lr
I believe that this is required to get the destination number into INVITE URI.

For From Domain, try
sip.sonetel.com

Your chan_sip configuration was not sending RPID or PAI, so try setting Send RPID/PAI to No.

It appears that in Asterisk SIP Settings, External Address and Local Networks are not correctly set. Sonetel seems to be doing NAT traversal at their end so it may not be a problem.
Based on what I see in the log, you should have
External Address: 46.12.124.111
Local Networks: 10.0.50.0 / 24

Your router/firewall is rewriting the source port number; line 145 has rport=49771. Can you configure it to pass the port unchanged?

If none of the above help and the error response from Sonetel doesn’t show what’s wrong, could you post a working INVITE from the system using chan_sip? Then, we could do whatever is needed to make the pjsip version match.

Here are the settings for my Sonetel pjsip trunk, assuming an email address of uuuu@dddd, pasword of pppp and Sonetel number of +12134567890. Everything not mentioned is left at default.

Trunk Name: Sonetel
Outbound CallerID: <+12134567890>
CID Options: Force Trunk CID
Username: uuuu
Auth Username: uuuu@dddd
Secret: pppp
SIP Server: sonetel.com
Qualify Frequency: 1200
Outbound Proxy: sip:sip.sonetel.com\;lr
Contact User: 12134567890
From Domain: dddd
From User: uuuu
Client URI: sip:uuuu@dddd
Match (Permit): 52.5.191.169,52.200.74.203,52.50.225.135,52.49.237.29,54.89.26.205
Send RPID/PAI: Send Remote-Party-ID header

I also set the addresses listed in Match (Permit) as Trusted in FreePBX Firewall.

Let me know whether this works for you.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.