[Asterisk-Users] Why does this Macro Loop?

Mystery Glitch mr_e_glitch at yahoo.com
Wed Apr 13 12:45:07 MST 2005


In my [incoming] context I have something like this:
exten => 8885861575,1,Macro(vrforward,${EXTEN},8136361451)


And thie Macro contains this:
[macro-vrforward]
exten => s,1,GotoIF($[${CALLERIDNUM} = 9545551111]?40:2)
exten => s,2,SetGroup(${ARG1})
exten => s,3,CheckGroup(3)
exten => s,4,SetAccount(${ARG1})
exten => s,5,Dial(SIP/1${ARG2}@termprovider,30,o)
exten => s,40,AGI(checkin|${ARG1})
exten => s,41,Hangup


Now, when I use my other server to set the caller ID to 9545551111 and place the call, I get this strange loop:

server*CLI>
    -- Executing Macro("SIP/5060-0825a308", "vrforward|8885861575|8136361451") in new stack
    -- Executing GotoIf("SIP/5060-0825a308", "1?40:2") in new stack
    -- Goto (macro-vrforward,s,40)
    -- Executing AGI("SIP/5060-0825a308", "checkin|8885861575") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/checkin

    -- Executing Macro("SIP/5060-0829c958", "vrforward|8885861575|8136361451") in new stack
    -- Executing GotoIf("SIP/5060-0829c958", "1?40:2") in new stack
    -- Goto (macro-vrforward,s,40)
    -- Executing AGI("SIP/5060-0829c958", "checkin|8885861575") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/checkin
    -- AGI Script checkin completed, returning 0
    -- Executing Hangup("SIP/5060-0825a308", "") in new stack
  == Spawn extension (macro-vrforward, s, 41) exited non-zero on 'SIP/5060-0825a308' in macro 'vrforward'
  == Spawn extension (company-in, 8885861575, 1) exited non-zero on 'SIP/5060-0825a308'
    -- AGI Script checkin completed, returning 0
    -- Executing Hangup("SIP/5060-0829c958", "") in new stack
  == Spawn extension (macro-vrforward, s, 41) exited non-zero on 'SIP/5060-0829c958' in macro 'vrforward'
  == Spawn extension (company-in, 8885861575, 1) exited non-zero on 'SIP/5060-0829c958'

    -- Executing Macro("SIP/5060-0829c958", "vrforward|8885861575|8136361451") in new stack
    -- Executing GotoIf("SIP/5060-0829c958", "1?40:2") in new stack
    -- Goto (macro-vrforward,s,40)
    -- Executing AGI("SIP/5060-0829c958", "checkin|8885861575") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/checkin
    -- AGI Script checkin completed, returning 0
    -- Executing Hangup("SIP/5060-0829c958", "") in new stack
  == Spawn extension (macro-vrforward, s, 41) exited non-zero on 'SIP/5060-0829c958' in macro 'vrforward'
  == Spawn extension (company-in, 8885861575, 1) exited non-zero on 'SIP/5060-0829c958'
    -- Accepting AUTHENTICATED call from 209.237.227.185, requested format = 4, actual format = 4
    -- Executing SetCIDNum("IAX2/vr1 at vr1/14", "") in new stack
    -- Executing SetGroup("IAX2/vr1 at vr1/14", "NOC Phone") in new stack
    -- Executing CheckGroup("IAX2/vr1 at vr1/14", "3") in new stack
    -- Executing Dial("IAX2/vr1 at vr1/14", "SIP/18885861575 at termprovider|30|o") in new stack
    -- Called 18885861575 at termprovider

    -- Executing Macro("SIP/5060-0829c958", "vrforward|8885861575|8136361451") in new stack
    -- Executing GotoIf("SIP/5060-0829c958", "0?40:2") in new stack
    -- Goto (macro-vrforward,s,2)
    -- Executing SetGroup("SIP/5060-0829c958", "8885861575") in new stack
    -- Executing CheckGroup("SIP/5060-0829c958", "3") in new stack
    -- Executing SetAccount("SIP/5060-0829c958", "000-8885861575") in new stack
    -- Executing Dial("SIP/5060-0829c958", "SIP/18136361451 at termprovider|30|o") in new stack
    -- Called 18136361451 at termprovider
    -- SIP/termprovider-d337 is making progress passing it to SIP/5060-0829c958
    -- SIP/termprovider-a01f is making progress passing it to IAX2/vr1 at vr1/14
  == Spawn extension (company-vr1, 18885861575, 4) exited non-zero on 'IAX2/vr1 at vr1/14'
    -- Executing Hangup("IAX2/vr1 at vr1/14", "") in new stack
  == Spawn extension (company-vr1, h, 1) exited non-zero on 'IAX2/vr1 at vr1/14'
    -- Hungup 'IAX2/vr1 at vr1/14'
  == Spawn extension (macro-vrforward, s, 5) exited non-zero on 'SIP/5060-0829c958' in macro 'vrforward'
  == Spawn extension (company-in, 8885861575, 1) exited non-zero on 'SIP/5060-0829c958'


My Macro is a simple shell script:

#!/bin/sh

lynx -dump 'http://www.ourdomain.com/manual.php?pg=admin/cronjobs/origination-check2&i_did='$1


 

------------

Why is it looping? It executes the right goto once, and then it starts all over again, and does it right again, and then starts over and this time sends it to the forwarded number, and the receiver gets the callerid all messed up, either all 0's or some strange local number, probably the local provider being used number.  The hangup doesn't terminate the channel, it just cyles again, after enough cycles the caller id gets lost and then ends up terminating. This system is designed to test our origination numbers, if we call any of our numbers with that specific caller id, the system should redirect it to an agi which sends it to a url to be added to a database. Then using Nagios we can check that url and make sure our numbers are all working.

I've tried Answer, AGI, Hangup  but to no avail. I then tried DeadAGI, Hangup, to no avail. So what's going on?

		
---------------------------------
Yahoo! Mail Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050413/f849c737/attachment.htm


More information about the asterisk-users mailing list