Page 281 - Asterisk™: The Future of Telephony
P. 281
<tr><td>Response</td><td>Success</td></tr>
<tr><td>Challenge</td><td>113543555</td></tr>
</table>
</body>
Similarly, if you use the mxml view instead, you will receive a response formatted as XML:
<Ajax-response>
<response type='object' id='unknown'>
<generic response='Success' challenge='113543555' />
</response>
</Ajax-response>
Other than the formatting, there are no other differences between the three types of
responses. For most applications, digging the challenge out of the keyword/value pairs
will be much simpler than using rawman or mxml in a situation like this, where you don’t
need to display the HTML to the user.
Transferring a call
The REDIRECT action can be used to transfer a call. Simply generate a URL such as:
http://localhost:8088/asterisk/rawman?action=redirect&channel=SIP/John-ae201e78
&priority=1&exten=6001
This URL transfers the specified channel to another extension and priority in the
dialplan. The response to this action is:
Response: Success
Message: Redirect Successful
Reading a configuration file
The GETCONFIG command returns the contents of a configuration file, or portion thereof.
The URL:
http://localhost:8088/asterisk/rawman?action=getconfig&filename=users.conf
returns the contents of the users.conf file. The Asterisk GUI uses this functionality to
present the current Asterisk configuration to the end user. The response looks like this:
Response: Success
Category-000000: general
Line-000000-000000: fullname=New User
Line-000000-000001: userbase=6000
Line-000000-000002: hasvoicemail=yes
Line-000000-000003: hassip=yes
Line-000000-000004: hasiax=yes
Line-000000-000005: hasmanager=no
Line-000000-000006: callwaiting=yes
Line-000000-000007: threewaycalling=yes
Line-000000-000008: callwaitingcallerid=yes
Line-000000-000009: transfer=yes
Line-000000-000010: canpark=yes
Line-000000-000011: cancallforward=yes
Developing for the Asterisk GUI | 253