Conditional Calling - Calling Operator

I have several locations that want to be able to dial zero and have the call directed to the front office of the location zero is dialed from. Each location has its own caller ID so that way I can find a way to route the call to the correct Operator.
I am planning on creating ring groups for each location but then add a macro that essentially checks that if someone dials zero (0) and the caller ID is matched then the call is directed to a particular ring group.

This is what I have thought of but does not work. I am not experience I am adding this to the extensions_custom.conf file:

[macro-Operator]
;;User dialing zero is redirected to Operator A
exten => s,1,GotoIf($["${OUTNUM}"=“0” & “${CALLERID(number)}”=“XXXXXXXXXX”]?2:4)
exten => s,2,Dial(“Local/7151@from-internal”)
exten => s,3,MacroExit()
;;User dialing zero is redirected to Operator B
exten => s,4,GotoIf($["${OUTNUM}"=“0” & “${CALLERID(number)}”=“YYYYYYYYYY”]?5)
exten => s,5,Dial(SIP/7152)
exten => s,6,MacroExit()

Currently I dial zero but nothing happens. Is this possible? Any help or pointers are appreciated. Thank you.

How do you want dialing 0 should get to this Macro?

You need to add something like

[from-internal]
exten => 0,1,Answer
exten => 0,n,Goto(macro-Operator,s,1)
1 Like

Thank you that makes sense and it now the macro is being called correctly but I need to work on the macro. Now anyone regardless of the caller ID rings the ring group.

It completely skips the first line of the macro.

[2018-10-10 17:13:07] VERBOSE[55696][C-000071e1] pbx.c: Spawn extension (macro-FrontOffice, s, 2) exited non-zero on ‘SIP/3063-0000cc38’
[2018-10-10 17:13:22] VERBOSE[56838][C-000071e3] pbx.c: Executing [0@from-internal:2] Goto(“SIP/3063-0000cc3a”, “macro-FrontOffice,s,1”) in new stack
[2018-10-10 17:13:22] VERBOSE[56838][C-000071e3] pbx_builtins.c: Goto (macro-FrontOffice,s,1)
[2018-10-10 17:13:22] VERBOSE[56838][C-000071e3] pbx.c: Executing [s@macro-FrontOffice:1] GotoIf(“SIP/3063-0000cc3a”, “0?2”) in new stack
[2018-10-10 17:13:22] VERBOSE[56838][C-000071e3] pbx.c: Executing [s@macro-FrontOffice:2] Dial(“SIP/3063-0000cc3a”, ““Local/3065@from-internal””) in new stack

macro-FrontOffice looks like what? and is a RG really what you want ( how does anyone ever dial 0 ? ) ?

@dicko sorry I had change the name of the macro. I am not sure I understand the question how does anyone ever dial 0?.
The idea of what I am trying to accomplish is someone in a building dials 0 and the call is directed to the front office in that building. e.g I am in building A and dial 0 and my call is directed to the front office in building A, if I am in building B and dial 0 the call goes to the front office in building B
Thank you for your comments.

Seems like a “misc application” with feature code “0” pointing to a “custom destination” that goes to your “macro,s,1” might work.

1 Like
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx.c: Executing [0@from-internal:2]     Goto("SIP/3063-0000e004", "macro-FrontOffice,s,1") in new stack
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx_builtins.c: Goto (macro-FrontOffice,s,1)
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx.c: Executing [s@macro-FrontOffice:1] GotoIf("SIP/3063-0000e004", "0?2:4") in new stack
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx_builtins.c: Goto (macro-FrontOffice,s,4)
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx.c: Executing [s@macro-FrontOffice:4]  GotoIf("SIP/3063-0000e004", "0?5") in new stack
[2018-10-11 12:34:31] VERBOSE[95548][C-00007cb8] pbx.c: Executing [s@macro-FrontOffice:5]    Dial("SIP/3063-0000e004", ""Local/3063@from-internal"") in new stack

If I am understanding this correctly the condition is evaluating to false thus not doing what I want. I guess I need to figure out how to check who dials zero because my gotoIf is not working.

I thought that OUTNUM would give me the number dialed and CALLERID(number) would give me the Outbound CID
GotoIf($["${OUTNUM}"=“0” & “${CALLERID(number)}”=“XXXXXXXXXX”]?2:4)

** From the Outbound route:
When extensions make outbound calls, the CallerID will be their extension number and NOT their Outbound CID. The above special matching sequences can be used for CallerID matching similar to other number matches.**

I suggest you add DumpChan() to your dialplan skills.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.