Sent into invalid extension

Morning all

im going around in circles here…

basically we have an office in the states that we have to close, but are keeping the phone numbers, we have agreed that somebody else will answer our calls so im trying to set up a call forward.

the american phone number (that is to be forwarded) is attached to a SIP trunk.

so, the call comes into Asterisk

Exten =>123456,1,Answer() Exten =>123456,n,GoTo(Internal,Warehouse,1)

within Internal i have

Exten =>Warehouse,1,GoTo(USA1,_NXXXXXXXXXX,2) Exten =>Warehouse,n,Hangup()

the actual dialling out bit

         Exten =>_NXXXXXXXXXX,1,Dial(SIP/voicepulse-primary/161000000001)
         Exten =>_NXXXXXXXXXX,n,GoTo(s-${DIALSTATUS},1]
         Exten =>_NXXXXXXXXXX,n,Hangup()

at the moment with testing the above code im receiving “Sent into Invalid extension _NXXXXXXXXX in context USA1”

its been awhile since i messed about with Asterisk code, if anyone could shed any light



You must use an actual number, not a pattern.

thanks for the reply

do you mean within the dial string?

         Exten =>_NXXXXXXXXXX,1,Dial(SIP/voicepulse-primary/161000000001)
         Exten =>_NXXXXXXXXXX,n,GoTo(s-${DIALSTATUS},1]
         Exten =>_NXXXXXXXXXX,n,Hangup()

the “161000000001” is just a random number i put on here - its not what i have in my actual dialplan.

the pattern match is what i used for our American users to dial out from, i thought this would have been suitable
so instead of the _NXXXXXXXXXX i will need a number?

         Exten =>_161000000001,1,Dial(SIP/voicepulse-primary/161000000001)
         Exten =>_161000000001,n,GoTo(s-${DIALSTATUS},1]
         Exten =>_161000000001,n,Hangup()

i will try this



You must redirect the call to a specific number. The exten lines presumably use a pattern for a valid reason.

Also please note that the dialplan fragments you are providing are not part of Asterisk, so you should really ask the person who wrote them.

Hi david its my coding, that i wrote years ago, but have have forgotten syntax etc…

i have now changed it so its even more simple

call comes in to asterisk

         Exten =>123456,1,Answer()
         Exten =>123456,n,GoTo(Internal,10,1)

hits the dial out bit

Exten =>10,1,Dial(SIP/voicepulse-primary/161000000001) Exten =>10,n,Hangup()

now if i dial our external number 123456 (this isnt the real number), i can see it come in, then pushed onto the SIP trunk but i cant hear no sound etc.

when i hang up i get a message on the cli thats says “Got SIP response 503 “service unavailable” back from”

but, if i dial 10 internally im connected onto 161000000001 without any issues