Freepbx DID issue in outgoing

I am not able to my DID as CLI on outgoing calls, I only get my pilot number as CID for all.

below is the dial plan logic which has been configured, help please to resolve the issue. Thank You.

exten => _7X.,1,SipAddHeader(P-Preferred-Identity: sip:[email protected])
exten => _7X.,n,Progress()
exten => _7X.,n,Dial(SIP/0${EXTEN:1}@tatasip)
exten => _7X.,n,Hangup()

By using that dialplan you are bypassing all FreePBX config. You probably want to dial to:

Dial(Local/0${EXTEN:1}@from-internal)

and then config outbound routes and trunk(s) to send the call normally.

not working what i want to achieve is whatever outbound CID I map with my extension that should override the trunk CID, below is my incoming logic, so if I try to map an outbound CID with an extension and make an outgoing call it doesnt go through.

[tata]
exten => _X.,1,Goto(s,1)

exten => s,1,Noop(Let us look deeper into the soul of the invite)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Goto(from-pstn,${pseudodid},1)

image

Can you give us an example of what you are trying to achieve.

Also, please post a call trace via pastebin link

Example - my subscriber CID number is 1356614100 which goes as outgoing CID on every call we make.
I have also got a child series of this pilot CID which is from 1356614101-1356614279.

I have mapped an Extension 2002 with an outbound CID 6614101 which should show as an outgoing CID to other end, which is not working.

Now as per trunk config I have made 6614100 as an outgoing CID, if I remove that then I am not able to dial out PBX says all circuits are busy I believe my dial plan has a header which takes my pilot CID 6614100 in it.

I want to override the CID 6614100, if I dial from 2002 with an outbound CID 6614101, I tried putting 6614101 on outbound CID of ext 2002 but my calls doesnt go out.


This is the format what my ISP want us to send while dialing from different DID number

At the Asterisk command prompt, type
sip set debug on
and make a test call. The SIP trace will appear in the Asterisk log for the call, along with the regular entries.

Look at the outgoing INVITE and confirm that you are adding the P-Preferred-Identity header and it is correctly formatted. If not, please post the code you are using to add the header, as well as the outgoing INVITE.

If that header is correct, check that the From header has the caller ID you want to send. For this to work correctly, you must not have a fromuser parameter in your trunk settings. Outbound CallerID for the trunk should be 6614100 and CID Options should be Allow Any CID.

If you still have trouble, paste the Asterisk log (including SIP trace) for a failing call at pastebin.freepbx.org and post the link here.

1 Like

It does not seem like you set a CID on 2002. Can you post a screenshot?

Also, as mentioned, PLEASE post logs via pastebin link. See instructions: https://wiki.freepbx.org/display/SUP/Providing+Great+Debug#ProvidingGreatDebug-AsteriskLogs-PartII

This is the header for outgioing.

exten => _7X.,1,SipAddHeader(P-Preferred-Identity: sip:[email protected])
exten => _7X.,n,Progress()
exten => _7X.,n,Dial(SIP/0${EXTEN:1}@tatasip)
exten => _7X.,n,Hangup()

Please please please, please post all these logs via pastebin.

Sorry I am new to forum how do I do it.

See above

Sorry I missed that please find the log link below.

https://pastebin.freepbx.org/view/d0440415

At the start of the log you posted, the call has already failed. Please post a complete log for an attempted call, likely about 500 lines. The most important section is the INVITE sent to the provider.

https://pastebin.freepbx.org/view/3e9cc802

Logs Above

The outbound INVITE (lines 822 - 851 of your paste) does not contain the P-Preferred-Identity header that TATA requires, so they rejected the call (paste lines 870 - 878).

The word ‘Identity’ does not appear anywhere in your paste, so whatever code you may have used to add that header apparently did not get executed.

A good way to add the header is with a predial hook; see

Sample code to go in /etc/asterisk/extensions_custom.conf (not tested) could be something like:

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Adding caller ID for TATA)
exten => s,n,SipAddHeader(P-Preferred-Identity: <sip:[email protected]>)
exten => s,n,MacroExit()

Restart Asterisk after modifying the file.

If no luck, look at the SIP trace to see whether P-Asserted-Identity is being properly added.

If you still have trouble, paste a new log.

But will this code overrides the CID configured in trunk? as I want DID of an extension to go out as CID. below is logic what TATA shared with me to dial out a CID

[1000]

exten => _7X.,1,SipAddHeader(P-Preferred-Identity: <sip:[email protected]>) à Please add the P-preferred-Identity header

exten => _7X.,2,Set(CALLERID(num)=6614101) à 6614101 would be the DID no. to be displayed…

exten => _7X.,3,Progress()

exten => _7X.,4,Dial(SIP/0${EXTEN:1}@tatasip)

exten => _7X.,5,Hangup()

Thanks Stewart the code is working and I am also getting different mapped DID on outgoing however I am not getting incoming calls.

below is the context which was given by TATA.

[tata]
exten => _X.,1,Goto(s,1)

exten => s,1,Noop(Let us look deeper into the soul of the invite)
exten => s,n,Set(pseudodid=${SIP_HEADER(To)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => s,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => s,n,Goto(from-pstn,${pseudodid},1)