Magnus Benngård
2009-Dec-20 10:15 UTC
[asterisk-users] Rewrite of calling number for all extensions
Hi! I am trying to figure out how to rewrite calling number for all extensions. What I am trying to do is: 1) Have a "block" of rewriting rules that will apply to all calls: Something like... (???),ExecIf($[${CALLERID(num)}=702221448]?Set(CALLERID(all)=Cecilia Benngard)) (???),ExecIf($[${CALLERID(num)}=705886363]?Set(CALLERID(all)=Magnus Benngard)) ... 2) Standard dialing rules... 971,1,Dial(SIP/0317998971) 975,1,Dial(SIP/0317998975) ... I know hot to do it per extension... 971,1,ExecIf($[${CALLERID(num)}=702221448]?Set(CALLERID(all)=Cecilia Benngard) 971,2,Dial(SIP/0317998971) But there must be a better way to do it, or? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20091220/53b83da2/attachment.htm
Magnus Benngård
2009-Dec-20 11:14 UTC
[asterisk-users] Rewrite of calling number for all extensions
Did found a way to do it: exten => 975,1,ExecIf($[${DB_EXISTS(CFIM/0317998975)}]?Goto(${DB(CFIM/0317998975)},1) exten => 975,2,Goto(set-caller-id,s,1) exten => 975,3,Goto(975-${DEVICE_STATE(SIP/0317998975)},1) exten => 975-INUSE,1,VoiceMail(0317998975 at inputinterior.se,bs) ...... [set-caller-id] ; exten => s,1,ExecIf($[${CALLERID(num)}=702221448]?Set(CALLERID(all)=Cecilia Benngard)) exten => s,1,ExecIf($[${CALLERID(num)}=705886363]?Set(CALLERID(all)=Magnus Benngard)) exten => s,2,Goto(inputinterior.se,${CALLERID(dnid)},3) Hi! I am trying to figure out how to rewrite calling number for all extensions. What I am trying to do is: 1) Have a "block" of rewriting rules that will apply to all calls: Something like... (???),ExecIf($[${CALLERID(num)}=702221448]?Set(CALLERID(all)=Cecilia Benngard)) (???),ExecIf($[${CALLERID(num)}=705886363]?Set(CALLERID(all)=Magnus Benngard)) ... 2) Standard dialing rules... 971,1,Dial(SIP/0317998971) 975,1,Dial(SIP/0317998975) ... I know hot to do it per extension... 971,1,ExecIf($[${CALLERID(num)}=702221448]?Set(CALLERID(all)=Cecilia Benngard) 971,2,Dial(SIP/0317998971) But there must be a better way to do it, or? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20091220/27a0931e/attachment.htm
Steve Edwards
2009-Dec-20 16:40 UTC
[asterisk-users] Rewrite of calling number for all extensions
On Sun, 20 Dec 2009, Magnus Benng??rd wrote:> Did found a way to do it: > > exten => 975,1,ExecIf($[${DB_EXISTS(CFIM/0317998975)}]?Goto(${DB(CFIM/0317998975)},1) > exten => 975,2,Goto(set-caller-id,s,1) > exten => 975,3,Goto(975-${DEVICE_STATE(SIP/0317998975)},1) > exten => 975-INUSE,1,VoiceMail(0317998975 at inputinterior.se,bs)Not really paying attention to what you are doing, but hitting the database 3 times for the exact same query could probably be cleaned up with a channel variable. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000