Sip - pjsip migration: Trunk DID override

Hi,
Finished migration to a much newer FreePBX (16), including migration to pjsip driver. Everything works with one huge issue. A VoIP provider doesn’t send DID (it’s blank) on incoming calls. This messes up the inbound routes. With former sip driver it was possible to specify a DID in a registration string after “/” (user:pass@server/DID format). Now can’t find any option to override it in pjsip. I have two lines like that - impossible to route the calls! So I had to temporarily revert the old sip driver. Is there any way to set a fixed DID in a trunk setup?
Thanks

The pjsip equivalent to the chan_sip register string parameter (after the /) is Contact User.

However, like on chan_sip, that’s a constant and you won’t be able to distinguish multiple numbers on the same account. If your provider sends the called number in the To header, changing the Context for the trunk to from-pstn-toheader may be a better solution.

Also, if your PBX has a static IP address and the provider supports it, consider switching to IP authentication and not using registration at all. This is more robust (no failures caused by ‘lost registration’) and is somewhat more secure (no SIP credentials to steal).

Is the DID in any of the headers on an inbound call, or is there otherwise a unique string in a header that identifies it to a DID? It’s pretty common for providers to to put it in the TO: header, in which case you can use the trunk context from-pstn-toheader to get it that way.

Not at all…

    -- Executing [s@from-pstn:1] Set("PJSIP/trunk-name-00000000", "__DIRECTION=INBOUND") in new stack
    -- Executing [s@from-pstn:2] Set("PJSIP/trunk-name-00000000", "CHANNEL(tonezone)=pl") in new stack
    -- Executing [s@from-pstn:3] ExecIf("PJSIP/trunk-name-00000000", "1?Set(__FROM_DID=s)") in new stack
    -- Executing [s@from-pstn:4] Set("PJSIP/trunk-name-00000000", "returnhere=1") in new stack
    -- Executing [s@from-pstn:5] Gosub("PJSIP/trunk-name-00000000", "app-blacklist-check,s,1()") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("PJSIP/trunk-name-00000000", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Set("PJSIP/trunk-name-00000000", "CALLED_BLACKLIST=1") in new stack
    -- Executing [s@app-blacklist-check:3] Return("PJSIP/trunk-name-00000000", "") in new stack
    -- Executing [s@from-pstn:6] Set("PJSIP/trunk-name-00000000", "CDR(did)=s") in new stack
    -- Executing [s@from-pstn:7] GotoIf("PJSIP/trunk-name-00000000", "0?") in new stack
    -- Executing [s@from-pstn:8] ExecIf("PJSIP/trunk-name-00000000", "1 ?Set(CALLERID(name)=001602*******)") in new stack
    -- Executing [s@from-pstn:9] Set("PJSIP/trunk-name-00000000", "__MOHCLASS=") in new stack
    -- Executing [s@from-pstn:10] Set("PJSIP/trunk-name-00000000", "__REVERSAL_REJECT=FALSE") in new stack
    -- Executing [s@from-pstn:11] GotoIf("PJSIP/trunk-name-00000000", "1?post-reverse-charge") in new stack
    -- Goto (from-pstn,s,13)
    -- Executing [s@from-pstn:13] NoOp("PJSIP/trunk-name-00000000", "") in new stack
    -- Executing [s@from-pstn:14] Set("PJSIP/trunk-name-00000000", "__CALLINGNAMEPRES_SV=allowed_not_screened") in new stack
    -- Executing [s@from-pstn:15] Set("PJSIP/trunk-name-00000000", "__CALLINGNUMPRES_SV=allowed_not_screened") in new stack
    -- Executing [s@from-pstn:16] Set("PJSIP/trunk-name-00000000", "CALLERID(name-pres)=allowed_not_screened") in new stack
    -- Executing [s@from-pstn:17] Set("PJSIP/trunk-name-00000000", "CALLERID(num-pres)=allowed_not_screened") in new stack
    -- Executing [s@from-pstn:18] NoOp("PJSIP/trunk-name-00000000", "CallerID Entry Point") in new stack
    -- Executing [s@from-pstn:19] Goto("PJSIP/trunk-name-00000000", "app-announcement-4,s,1") in new stack
    -- Goto (app-announcement-4,s,1)

That’s the from-pstn context, not the from-pstn-toheader one.

Wow that worked! Thanks!

So basically changed the pjSIP trunk context to from-pstn-toheader.

Still it’s unfortunate I can’t override it. It was a good feature. If the provider makes any change in “to” field, for example add/remove country code or whatever else, things will stop working.

Did you try setting Contact User for the trunk to what you previously had after the slash in your chan_sip register string (while leaving Context blank, which defaults to from-trunk)? If so and that didn’t work, what was the result?

Contact user doesn’t seem to do anything.
As a side note, funny thing. I have 2 trunks (which are just simple SIP registrations, each having different SIP user and assigned PSTN number), say A and B. Incoming call always come via trunk B (at least it appears so in the logs) regardless the number dialled, so “manually” setting DID based on the trunk it goes thru would not work properly anyway. I think it wasn’t the case with the legacy chan_SIP module.

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