Dialplan issue asterisk


We are having one or two issues setting up a gradwell SIP Trunk with our asterisk PBX and wondered if anyone might be able to shed any light on it.

Basically we have our asterisk PBX registered on gradwells server with no problems, but when we try to dial out we get an error response from gradwell “Forbidden” which related to us not sending our caller ID

We found this article on their website https://support.gradwell.com/entries/23669137-Configuring-an-outbound-SIP-trunk-on-an-Asterisk-PBX which states we must add our outgoing caller ID to the dial plan (Extensions) which we have now done (Gradwell require us to do this)

But we now get an error WARNING[8270]: pbx.c:4458 pbx_extension_helper: No application ‘SetCallerID’ for extension (default, 07900883755, 1)
[Jun 16 18:23:03] == Spawn extension (default, 07900883755, 1) exited non-zero on ‘SIP/8002-00000010’
[Jun 16 18:23:03] – Executing [h@default:1] AGI(“SIP/8002-00000010”, “agi://–HVcauses–PRI-----NODEBUG-----0---------------”) in new stack
[Jun 16 18:23:03] – <SIP/8002-00000010>AGI Script agi://–HVcauses–PRI-----NODEBUG-----0--------------- completed, returning 0

Its definitely a dialplan issue but its got us stumped, can anyone suggest anything ?

Kind regards


exten => _X!,2,Set(CALLERID(NUM)=0123456789)

The application is Set and you use it on the CALLERID(num) function. SetCallerID may have existed in the dim and distance past.

However, normally one uses fromuser in sip.conf. Is there any reason why that won’t work in this case?

Hi Guys

Thanks for your help and input on this, it is very much appreciated.

You were indeed correct i was using an old caller id format from some time ago i updated this to what you suggested and the error went away but still i cannot get any outgoing calls

Incoming works as it should

i now get the following error

[Jun 18 01:05:43] – Executing [07891714406@default:1] Set(“SIP/8002-00000011”, “CALLERID(NUM)=01204238786”) in new stack
[Jun 18 01:05:43] – Executing [07891714406@default:2] Dial(“SIP/8002-00000011”, “sip/07891714406@GRADWELL”) in new stack
[Jun 18 01:05:43] == Using SIP RTP CoS mark 5
[Jun 18 01:05:43] – Called sip/07891714406@GRADWELL
[Jun 18 01:05:43] WARNING[3628]: chan_sip.c:21126 handle_response_invite: Received response: “Forbidden” from ‘“8002” sip:01204238786@>;tag=as7f1e5e6d’
[Jun 18 01:05:43] == Everyone is busy/congested at this time (1:0/0/1)
[Jun 18 01:05:43] – Executing [07891714406@default:3] Hangup(“SIP/8002-00000011”, “”) in new stack
[Jun 18 01:05:43] == Spawn extension (default, 07891714406, 3) exited non-zero on ‘SIP/8002-00000011’
[Jun 18 01:05:43] – Executing [h@default:1] AGI(“SIP/8002-00000011”, “agi://–HVcauses–PRI-----NODEBUG-----21-----CHANUNAVAIL----------”) in new stack
[Jun 18 01:05:43] – <SIP/8002-00000011>AGI Script agi://–HVcauses–PR

Our trunk config


Our dialplan

exten => _X!,1,Set(CALLERID(NUM)=01204238786)
exten => _X!,2,Dial(sip/${EXTEN}@GRADWELL)
exten => _X!,3,Hangup

allowguest can only appear in the general section.
yes is deprecated as a parameter for nat; use the specific options that you need
username is a deprecated/obsolete name for defaultuser.

Although the default nat= settings are often sufficient for Asterisk inside case, if you have NAT you need to tell Asterisk how to find its external address, so you need to use one of the external address options and/or stunaddr. nat= doesn’t do that; it just applies various hacks to work round the damage caused by NAT, particularly Asterisk outside cases.

More generally, you need to provide sip debug logs, to show where the protocol is getting stuck.


Gradwell replies with 403 Forbidden for some reason - may be caller ID you send is not in the correct format? It would be more helpful if you provided full SIP callflow using debug (sip set debug on from CLI).

NAT misconfiguration could also be the cause of this issue - if you send SIP INVITE with your private IPs in the body, Gradwell could reject them in this manner.

add the fromuser option to your trunk configuration


This corrected a similar problem for me once with a different provider. Worth a try.