Summary:ASTERISK-12194: Hangup extension doesn't seem to work in ast-
Reporter:Binu Nair (binuvb)Labels:
Date Opened:2008-06-14 07:24:28Date Closed:2008-08-01 11:19:31
Versions:Frequency of
Description:Hello all,
      I have made a call back service using the call files. Here people would call on some predetermined number, the system recognizes the caller id (we have a caller id database) and disconnects the call and call back. If the system could not recognize the caller id, it plays a message and gives options to register the caller id, etc. All these works well in asterisk 1.4.4. The problem started when I upgraded asterisk to version
      I am attaching the portion of the context.

      When the system receives a call, it just hangs up and the rest is done in "h" extension.

    I guess this is a problem with h extension in the version ( as I said earlier that it works very well with 1.4.4).
    In the asterisk console I am able to see "Playback(prompt_register_cid)" , but it is not actually playing.

Thanks all


exten => s,1,Set(authcallerid = 0|caller=${CALLERID(num)}|callerfull=${CALLERID(num)})
exten => s,n,Hangup
exten => h,n,Gotoif($[${LEN(${caller})} <  7]?trikon,s,11)
exten => h,n,DeadAGI(/usr/local/ownmail/bin/auth_user,1,${caller})
exten => h,n,Gotoif($[${auth}>0]?+3:+1)
;some lines here creates a call file for callback, all these are done from the AGI call.
exten => h,n,Playback(prompt_register_cid)
exten => h,n,Goto(mainn,s,1)
exten => h,n,Hangup

Comments:By: Tilghman Lesher (tilghman) 2008-06-14 09:15:37

> exten => s,n,Hangup
> exten => h,n,Gotoif($[${LEN(${caller})} < 7]?trikon,s,11)

Here's your problem.  Your h extension doesn't start with "1".  Change this to:

> exten => s,n,Hangup
> exten => h,1,Gotoif($[${LEN(${caller})} < 7]?trikon,s,11)

and I think you'll find that things work fine.

By: Binu Nair (binuvb) 2008-06-16 00:42:47

I missed one line in my post (0012857). In fact the hangup DID start with 1.
I was hardcoding a caller id for my testing. The following line was doing that.

exten => h,1,Set(caller=15555555)

Thanks once again and sorry for the trouble

By: Joshua C. Colp (jcolp) 2008-06-16 07:07:34

How about attaching the actual console log when this context is executed?

By: Binu Nair (binuvb) 2008-06-16 07:55:26

-- Executing [17813821904@trikon:1] NoOp("SIP/", "912224318815") in new stack
   -- Executing [17813821904@trikon:2] Goto("SIP/", "callback|s|1") in new stack
   -- Goto (callback,s,1)
   -- Executing [s@callback:1] Hangup("SIP/", "") in new stack
 == Spawn extension (callback, s, 1) exited non-zero on 'SIP/'
   -- Executing [h@callback:1] Set("SIP/", "authcallerid = 0|caller=912224318815|callerfull=912224318815") in new stack
[Jun 16 18:31:21] WARNING[2456]: pbx.c:5870 pbx_builtin_setvar: Setting multiple variables at once within Set is deprecated.  Please separate each name/value pair into its own line.
   -- Executing [h@callback:2] NoOp("SIP/", "912224318815") in new stack
   -- Executing [h@callback:3] NoOp("SIP/", "") in new stack
   -- Executing [h@callback:4] NoOp("SIP/", "912224318815") in new stack
   -- Executing [h@callback:5] Set("SIP/", "caller=4318815") in new stack
   -- Executing [h@callback:6] GotoIf("SIP/", "0?trikon|s|11") in new stack
   -- Executing [h@callback:7] DeadAGI("SIP/", "/usr/local/ownmail/bin/auth_user|1|4318815") in new stack
   -- Launched AGI Script /usr/local/ownmail/bin/auth_user
   -- AGI Script Executing Application: (Set) Options: (authcallerid=0)
   -- AGI Script /usr/local/ownmail/bin/auth_user completed, returning 0
   -- Executing [h@callback:8] GotoIf("SIP/", "0?+1:+4") in new stack
   -- Goto (callback,h,12)
   -- Executing [h@callback:12] Playback("SIP/", "trikon/register_cid") in new stack
 == Spawn extension (callback, h, 12) exited non-zero on 'SIP/'
[Jun 16 18:31:21] NOTICE[2456]: cdr.c:432 ast_cdr_free: CDR on channel 'SIP/' not posted

It clearly says executing Playback, but actually line is disconnected whereas it works perfectly in ast-1.4.4

By: Tilghman Lesher (tilghman) 2008-07-14 12:32:07

I'm not really convinced that this SHOULD work.  You're clearly abusing what a hangup is supposed to do, and we probably fixed a bug that made this previous exploitation fail.

Most people who implement callback do so by generating a .call file and placing the file within /var/spool/asterisk/outgoing, not by overloading the "h" extension.