[asterisk-users] how to get the status of failed call files

Rich Doughty rich at opusvl.com
Thu Feb 1 10:21:36 MST 2007


Richard Lyman wrote:
> Rich Doughty wrote:
>> Richard Lyman wrote:
>>> Rich Doughty wrote:
>>>> i am creating call files, and catching successfully the ones that don't
>>>> connect in a 'failed' extension. can anyone tell me how to find out the
>>>> reason for the failure (ie busy, no answer).
>>>>
>>>> ${DIALSTATUS} doesn't appear to get set (presumably because Dial() 
>>>> isn't
>>>> used) and channel_status doesn't seem to be any good.
>>>>
>>>> thanks in advance.
>>>>
>>> the event you received for OriginateFailure has a 'Reason: ' code.
>>>
>>> that code breaks down as
>>>
>>> 0 = UNKNOWN FAILURE or DISCONNECT
>>> 3 = AST_CONTROL_RINGING (no answer)
>>> 5 = AST_CONTROL_BUSY
>>> 1 = AST_CONTROL_HANGUP
>>> 8 = AST_CONTROL_CONGESTION
>>
>> i didn't originate the call with manager, but with a call file, so i 
>> can't
>> get manager events. i there any other way of finding this out?
>>
>>
> if DIALSTATUS or HANGUPCAUSE don't have what you need then you will need 
> to mod pbx.c
> 
> look for a section of code that looks like this
> 
>                        /* create a fake channel and execute the "failed" extension (if it exists) within the requested cont
>                        /* check if "failed" exists */
>                        if (ast_exists_extension(chan, context, "failed", 
> 1, NULL)) {
>                                chan = ast_channel_alloc(0);
>                                if (chan) {
>                                        ast_copy_string(chan->name, "OutgoingSpoolFailed", sizeof(chan->name));
>                                        if (!ast_strlen_zero(context))
>                                                ast_copy_string(chan->context, context, sizeof(chan->context));
>                                        ast_copy_string(chan->exten, "failed", sizeof(chan->exten));
>                                        chan->priority = 1;
>                                        ast_set_variables(chan, vars);
> insert pbx_builtin_var here -->
>                                        ast_pbx_run(chan);
> 
> since DIALSTATUS and HANGUPCAUSE are both protected, you will probably 
> have to create another such as FAILEDCODE.
> 
> i hope this helps.

ok. thanks. HANGUPCAUSE only seems to return 0. if it's not possible to
find this out whilst using call files (as it appears) i'll take a look
at using manager.

-- 

   - Rich Doughty


More information about the asterisk-users mailing list