[Asterisk-Users] Call completion/error codes and extensions.conf call flow

Tilghman Lesher
Sun, 06 Apr 2003 21:06:21 -0000

On Sunday 06 April 2003 14:09, John Todd wrote:
> There was a conversation last night on the IRC channel between
> myself, Corydon76, citats, and kram on the ability of a call
> process to access the error (or success?) codes underlying a
> call.  I'm uncertain if anything came out of it, but I'll
> re-hash here to solicit other comments.
>
> My idea: I'd like to be able to get to error codes when a call
> passes through some kind of action (with perhaps the exception
> of "Trying" or other "non-end-of-message" results) so
that I
> can play error messages or take actions that are appropriate
> to the event.  As an example, currently Asterisk only supports
> "busy" or "unavailable" call codes back from any
channel type.
>  However, chan_sip can provide a large array of codes that are
> more meaningful, such as "403 Forbidden" or "480 Temporarily
> unavailable" which can be more useful for both my internal
> logging as well as can trigger an appropriate recording to be
> played back to the user.  Why code individual cases inside of
> chan_blah when this can be extracted to allow the admin to
> handle them as required?
>
> Two solutions were discussed, one method using an application
> and the other simply setting a channel variable.
>
> METHOD 1:
> Corydon76 suggested creating an application that handled the
> redirection of the call process flow.  This would look
> something like this:
>
> OnResultGoto(201:+100,405:+200,480:+250)
>
> where "201", "405", and "480" are the numeric
response codes
> corresponding to some useful error message from the channel.
> This would be called immediately the Dial application.  Jumps
> would be done within the existing context, to the priority X
> within the same context where X is represented by "+X".

Here's the application and the patch needed in the pbx code to
support the result code accessed from the application.  In
addition to the relative branches mentioned in the channel, I
also made absolute branches work (in the usual [[con]|ext]|pri
format).

Again, untested code.

-Tilghman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pbx_chanresult.diff
Type: text/x-diff
Size: 2806 bytes
Desc: not available
Url :
http://lists.digium.com/pipermail/asterisk-users/attachments/20030406/3952e58b/pbx_chanresult.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app_onresultgoto.c
Type: text/x-csrc
Size: 4874 bytes
Desc: not available