[asterisk-users] ResetCDR after GotoIf doesn't set dst correctly, Is this a bug?

Zeeshan Zakaria zishanov at gmail.com
Wed Jul 15 10:48:50 CDT 2009


To do the same in AEL, use 'catch' construct (ref
https://issues.asterisk.org/view.php?id=14956). This is so that we can catch
extension h and return to the calling macro, so that it can continue its
priority after the Dail command. I've tested it and it works.

context test {
    _NXXNXXXXXX => {
        &test-dialout(${EXTEN});
    };
    h => {
        &test-hangup(${EXTEN});
    };
};

macro test-dialout(number) {
    Dial(IAX2/XXXXX/${number},30);
    catch h {
        return;
    };
};

macro test-hangup(number) {
    NOOP(${number});
    if ("1"="1") {
        NOOP(Hello);
    };
    ResetCDR(vw);
    NoCDR();
    Hangup();
};


Also the correct syntax for regular conf will be:

[test]
exten => _NXXNXXXXXX,1,macro(test-dialout,${EXTEN})

[macro-test-dialout]
exten => s,1,Dial(IAX2/6477226961/${ARG1})
exten => h,1,Macro(test-hangup)

[macro-test-hangup]
exten => s,1,GotoIf($["1"="1"]?2:3)
exten => s,n,NoOp(A)
exten => s,n,ResetCDR(vw)
exten => s,n,NoCDR()
exten => s,n,Hangup()


On Wed, Jul 15, 2009 at 10:36 AM, Zeeshan Zakaria <zishanov at gmail.com>wrote:

> I've found a work around, i.e. if put the dialout command in a separate
> macro, then CDR records the values fine, whether the hangup macro is called
> by the original context, or by the dialing macro.
>
> Posting here in case somebody facing a similar issue like me can benefit
> from it:
>
> [test]
> exten => _NXXNXXXXXX,1,macro(test-dialout,${EXTEN})
> exten => h,1,Macro(test-hangup)
>
> [macro-test-dialout]
> exten => s,1,Dial(IAX2/6477226961/${ARG1})
> ;exten => h,1,Macro(test-hangup)
>
> [macro-test-hangup]
> exten => s,1,GotoIf($["1"="1"]?2:3)
> exten => s,n,NoOp(A)
> exten => s,n,ResetCDR(vw)
> exten => s,n,NoCDR()
> exten => s,n,Hangup()
>
>
> On Wed, Jul 15, 2009 at 10:18 AM, Zeeshan Zakaria <zishanov at gmail.com>wrote:
>
>> (Both on Asterisk 1.2 and 1.4)
>>
>> I was struggling to find out why my CDR was recording dst = h after a call
>> hangup. It was working fine until I added a GotoIf statement before ResetCDR
>> to calculate some value for userfield column. Today I tested and found out
>> that if ResetCDR is put after GotoIf (or after if in AEL), it doesn't record
>> correct value in dst column, and isntead puts 'h' there. If GotoIf removed,
>> it works fine.
>>
>> Is this is a bug, or is this how it is supposed to work? Is there any work
>> around it. In my production scenario, I can't move ResetCDR before GotoIf.
>>
>> Here are the test context and macro:
>>
>> [test]
>> exten => _NXXNXXXXXX,1,Dial(IAX2/XXXXX/${EXTEN},30)
>> exten => h,1,Macro(test-hangup)
>>
>> [macro-test-hangup]
>> exten => s,1,GotoIf($["1"="1"]?2:3)
>> exten => s,n,NoOp(A)
>> exten => s,n,ResetCDR(vw)
>> exten => s,n,NoCDR()
>> exten => s,n,Hangup()
>>
>>
>> --
>> Zeeshan A Zakaria
>>
>
>
>
> --
> Zeeshan A Zakaria
>



-- 
Zeeshan A Zakaria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090715/9690126e/attachment.htm 


More information about the asterisk-users mailing list