Need Help - Newbie Question

Hi people,wondering if you can help.

I have an entry in my extensions.conf like so:

[inbound] exten => 6458155,1,Answer exten => 6458155/07929902xxx,2,Set(CALLERID(name)=Alun Mobile) exten => 6458155,3,Dial(SIP/alun&SIP/mythphone,,r)

This works fine if i dial into asterisk using my mobile phone,I see “Alun Mobile” flash up on my screen.
If i dial in from any other phone,then asterisk answers,shows no caller display,then hangsup after 10 seconds.
I need to add some extra rules but i’m not sure of how to do it.

I think i need to use the “GotoIf” command,but i’m unsure of the usage.
I want any other number just to display the number and still ring the same extensions.

Thanks in advance.


exten => 6458155,1,Answer
exten => 6458155/07929902xxx,2,Set(CALLERID(name)=Alun Mobile)
exten => 6458155,3,Dial(SIP/alun&SIP/mythphone,r) [/quote]
Im using something like this for about 30 numbers and its working good

    exten => s/050XXXXXX,1,Dial(${all})
    exten => s/050XXXXXX,1,Dial(${ext1})
    exten => s/068XXXXXX,1,Dial(${BOSS})
;---------other nubers
    exten => s,1,Goto(pbx_IVR|s|1)

You have
extens => EXT,priority,action
there is a mess with priority, You have 1,2,3 for Your cell number
but 1,3 for others… so there is a hole.
Try using ‘s’ exten or ‘n’ priority


OK Thanks for the fast reply.

I’m studying your example to see if i can figure the logic behind it.
I’m decoding it with my “Asterisk The Future Of Telephony” book :smiley:


I tried but i couldn’t work out how to implement your way of doing it.
I tried to decode it,but it’s way over my head.

I did however manage to get it working like this:

exten => 6458155,1,Answer exten => 6458155,2,Wait(2) exten => 6458155,3,GotoIf($[${CALLERIDNUM} = 07929902xxx]?4:5) exten => 6458155/07929902xxx,4,Set(CALLERID(name)=Alun Mobile) exten => 6458155,5,Dial(SIP/alun&SIP/mythphone|10,,r) exten => 6458155,6,Playback(vm-nobodyavail) exten => 6458155,7,Hangup()

I don’t understand when you say there is a mess with priority,and there is a hole.
Please explain. How can i fix it?

Thanks for your imput.


Maybe try this

exten => 6458155,1,Answer
exten => 6458155,2,Wait(2)
exten => 6458155,3,NoOP(${CALLERID})
exten => 6458155,4,GotoIf($["${CALLERIDNUM:0:10}" = “calleridnumber”]?setcid,s,1:5)
exten => 6458155,5,Dial(SIP/alun&SIP/mythphone|10,r)

exten => s,1,Set(CALLERID(name)=Alun Mobile)
exten => s,2,Dial(SIP/alun&SIP/mythphone|10,r)

now if the callid = what you put in “calleridnumber” is should jump to the setcid context if it doenst match tehn it will simply go to priority 5

Sorry i haven’t replied to this sooner,but I’ve been busy cooking Indian food all day!
It takes a long time to prepare,but man it’s tasty. :smiley:

I haven’t had time to try your recipe,(pun intended).
What are the advantages of doing it your way instead of mine?

I like to do everything the best,most efficient way,so i’d like to know.

Thanks for helping.


You have here:
context = inbound
extension(A) = 6458155
extension(B) = 6458155/07929902xxx

for extension(A) there is priorities 1 and 3
exten => 6458155,1,Answer
exten => 6458155,3,Dial(SIP/alun&SIP/mythphone,r)
there is no prority 2 (i called it a hole)
taht what i kno Asterisk work like this:

  • we are in context [inbound]
  • what extension ? - 6458155
  • execute priority 1 - ok = Answer
  • execute next pririty - 2 - no such priority = hangup
  • asterisk will not reach pririty 3 - Dial(SIP/…)

if You change extension ‘6458155’ to ‘s’, then it will work like

  • we are in context …
  • extension s (first in line)
  • s/number1 - does callerid = number ? =yes (do what must be done) / no (skip)
  • s/nuber 2 …
  • s/nuber N
  • s (callerid number not specified) do whatever You want
    Note: prorities still apply in s/number ans s extensions

You don’t have to use ‘s’ extension. Asterisk can check CALLERID as rusty post and jump using goto()

You could try this in extensions.conf:

[inbound] exten => 6458155,1,Goto(checkcallerid|s) [checkcallerid] exten => s/07929902xxx,1,answer exten => s/07929902xxx,2,Set(CALLERID(name)=Alun Mobile) exten => s/07929902xxx,3,Dial(SIP/alun&SIP/mythphone,,r) exten => s/07929902xxx,4,hangup exten => s,1,answer exten => s,2,Dial(SIP/alun&SIP/mythphone,,r) exten => s,3,hangup

OK, Thanks for taking the time to explain it all to me.
It’s all starting to make sense now.

I spent the whole day yesterday experimenting with it.
I have it setup the way rusty has shown it.
I even managed to configure a basic voicemail setup!

Thanks again.

:smiley: :smiley: