Outbound call fails because number is not included in the sip invite


I’m having some issues with outgoing calls to a PJSIP trunk (flowroute).

Asterisk 16.17.0


When I make a call from a softphone (zoiper5) on the local network the call is immediately ended and I see a few interesting things in logs. Ultimately the call is rejected by flowroute with a 500 error. Looking at call logs on the flowroute side it looks like the invite is trying to make a call to my sip account number and not the dialed phone number. Looking at logs seems to confirm this <sip:[email protected]

Interestingly if I make a call to a custom dial plan and then have that dial plan connect me to the trunk directly PJSIP/<NUMBER>@fl avoiding the Freepbx outbound route, the call is works as expected.

My outbound route is very basic

It just allows all calls to go through the only trunk I have called fl
Dial patterns are

Any help or suggestions is much appreciated.

I have had to remove all logs and screenshots because I keep getting an error telling me new users can’t post links. I’m assuming the flowroute url and IP address in the logs are causing this error.

Here are some logs

Dial(“PJSIP/203-00000023”, “PJSIP/@fl,r”) in new stack
[2021-10-27 23:50:28] VERBOSE[7768][C-00000013] app_dial.c: Called PJSIP/@fl
SIP/2.0 500 Internal Server Error

At the Asterisk command prompt (not a shell prompt), type
pjsip set logger on
make a failing call attempt to e.g. 18004377950 , paste the complete Asterisk log for the call (which will include a SIP trace) at pastebin.freepbx.org and post the last 8 hex characters of the link here (you are too new to post links). Of course, redact your phone number and account number, but make it clear what the replaced values represent.

Thanks for the pastebin tip! Here are the full logs with pjsip logger on.


Edit… looks like the freepbx pastebin threw a php error. Here are the logs on the OG pastebin

It appears that some customization has interfered with normal FreePBX functioning. The call was fine through:
[2021-10-27 23:50:28] VERBOSE[7768][C-00000013] pbx.c: Executing [[email protected]:3] ExecIf("PJSIP/203-00000023", "0 ?Set(CDR(accountcode)=)") in new stack

The next line should have set _ROUTEID , but instead did:
[2021-10-27 23:50:28] VERBOSE[7768][C-00000013] pbx.c: Executing [[email protected]:4] System("PJSIP/203-00000023", "mkdir "/var/spool/asterisk/spoofBot9000"") in new stack

I have no idea what spoofBot9000 is and found no reference on Google. Is this code of yours? Or some module you installed? Try removing that and retest; if it still fails paste another log.

1 Like

It’s just a directory where some recordings are stored, triggered by a dial plan.

I was not using the dial plan at the time of these tests. Looking at the dial plan it had a context of [from-internal]. After changing that all is working as expected!

Thanks so much for taking the time to help, I guess I need to go brush up on how contexts work.

Based on nothing but a wild guess, I suspect you would benefit from reading this post about dialplan hooks Hooking for fun and income