Skip to content

Instantly share code, notes, and snippets.

@debojitkakoti
Created February 15, 2015 05:22
Show Gist options
  • Save debojitkakoti/908417a5db25f456dd1c to your computer and use it in GitHub Desktop.
Save debojitkakoti/908417a5db25f456dd1c to your computer and use it in GitHub Desktop.
Hangup cause in asterisk using phpagi
<?php
require_once('phpagi.php');
$agi = new AGI();
$clid = $agi->request['agi_callerid']; // -Caller ID
$dest = $agi->request['agi_dnid']; // -Destination id
$uid = $agi->request['agi_uniqueid'];
$rdnis =$agi->request['agi_rdnis']; //Redirected Dialed Number Information Service
$hangupcause_string=$agi->get_variable("HANGUPCAUSE_KEYS()");
$hangupcause_string_data = $hangupcause_string['data'];
$hanupcause_code=$agi->get_variable("HANGUPCAUSE($hangupcause_string_data,tech)");
$hangupcause_code_data = $hanupcause_code['data'];
$hangupcause_ast=$agi->get_variable("HANGUPCAUSE($hangupcause_string_data,ast)");
$hangupcause_ast_data = $hangupcause_ast['data'];
$agi->set_variable("HANGUPPPPPPPPPCAUSE STRING DATA",$hangupcause_string_data);
$agi->set_variable("HANGUPPPPPPPPPCAUSE CODE DATA",$hangupcause_code_data);
$agi->set_variable("HANGUPPPPPPPPPCAUSE AST DATA",$hangupcause_ast_data);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment