Yealink Forums
XML and posting back to the script - Printable Version

+- Yealink Forums (http://forum.yealink.com/forum)
+-- Forum: IP Phone Series (/forumdisplay.php?fid=4)
+--- Forum: General topics (/forumdisplay.php?fid=15)
+--- Thread: XML and posting back to the script (/showthread.php?tid=1342)



XML and posting back to the script - lekcomp - 03-01-2014 01:16 AM

We are considering switching our install base for new systems from Aastra phones to Yealink phones. I'm converting my scripts from Aastra to Yealink as I try them out to get a feel for functionality. It's similar but different enough to frustrate me. GRRR!

So, what I'm attempting to accomplish is nesting menus. I would like the user to be presented with a menu and then depending on which they choose it moves down to that section. The movement is controlled using the switch($ACTION) and case commands. What I'm unsure of is how to link the keypress to the switching. Here is some code as example:

$ACTION="list" ;


switch($ACTION)
{
case 'list':
echo '<TextMenu>'."\n" ;
echo '<MenuItem>'."\n".'<Prompt>Extension List</Prompt>'."\n"."<URI>$ACTION='extension'</URI>"."\n".'</MenuItem>'."\n" ;
echo '</TextMenu>'."\n" ;
break ;



case 'extension':
//---------- Place Extensions into ARRSTORE ----------#
$AS = new AGI_AsteriskManager();
$RES = $AS->connect();
$RAW=$AS->database_show('AMPUSER');

//---------- Place Mailboxes and Names into ARRSTORE ----------#
$ARRSTORE = array() ;
foreach($RAW as $KEY=>$VALUE)
{
if(strstr($KEY,'cidname'))
{
$NUMBER=preg_replace(array('/\/AMPUSER\//','/\/cidname/'),array('',''),$KEY);
$ARRSTORE[$VALUE] = $NUMBER;
}
}
ksort($ARRSTORE);
//---------- Send To Phone ----------#
echo '<YealinkIPPhoneDirectory'."\n";
echo 'style="radio"'."\n";
echo 'Beep="no"'."\n";
echo 'defaultIndex="1"'."\n";
echo '>'."\n";
echo '<Title wrap="yes">Dial Plus</Title>'."\n";
foreach($ARRSTORE as $KEY=>$VALUE)
{
echo "<MenuItem>\n" ;
echo "<Prompt>$KEY</Prompt>"."\n" ;
echo "<URI>$VALUE</URI>" ;
echo "</MenuItem>\n" ;
}
echo '</YealinkIPPhoneDirectory>'."\n";
break;

}

If I do each case individually they work. I'm just looking for some insight as to how to pass the $ACTION variable to be able to post I guess. Thanks for any help.

Just figured it out.


Change
case 'list':
echo '<TextMenu>'."\n" ;
echo '<MenuItem>'."\n".'<Prompt>Extension List</Prompt>'."\n"."<URI>$ACTION='extension'</URI>"."\n".'</MenuItem>'."\n" ;
echo '</TextMenu>'."\n" ;
break ;

To
case 'list':
echo '<TextMenu>'."\n" ;
echo '<MenuItem>'."\n".'<Prompt>Extension List</Prompt>'."\n"."<URI>http://$PATHTOSCRIPT/$SCRIPTNAME.php?ACTION=extension</URI>"."\n".'</MenuItem>'."\n" ;
echo '</TextMenu>'."\n" ;
break ;

Just FYI.


RE: XML and posting back to the script - Yealink Support - 03-01-2014 10:55 AM

Thanks to your kindly sharing. Big Grin