Aastra Scripts

Hello all! I’ve been active over at PIAF for the last couple of years but lgaetz has convinced me to branch out over here and see the other side. I’ve downloaded the FreePBX Distro and am trying it out in a virtual environment. Most of our phones are Aastra (with some Polycom) and I’ve seen that there is mention of scripts that are maintained over here for the Aastra phones. Is that true? I don’t see anything included in the distro, but I could be blind. Where can I look for those? Thanks!

The scripts are no longer maintained by Aastra nor here (FreePBX/Schmooze) for legal reasons, they do however still work with a little tweaking for newer versions of Asterisk/FreePBX.

As announced at Astricon we have a whole new Rest Apps module coming out that will run phone side apps on over 60 different devices. We will start Beta testing things by the end of the year.

As far as your existing question you can yum install aastra-xml-scripts to get the old XML scripts that we have patched together for FreePBX Distro.

I’ve downloaded them and they appear to be the same ones I’m already using. (Version 2.3.1 Final Build 20120222) Any idea where I can get a little help in writing my own scripts? I’m trying to make some that were compatible with the 2.6 FW become compatible with the 3.x firmware. I’m sure I’m close but can’t figure out what’s wrong. Aastra has told me straight up that they will not help as it isn’t supported and I haven’t received any help in the PIAF forums so I’m hoping someone here can help.

Stewart

I know those scripts work with FreePBX 2.10 or greater and Aastra Firmware 3.X as we use them all the time. As far as helping you I dont think anyone here besides us and Dicko actually understand them and we at this time are not offering support or advice on them and with the soon to be launched apps from us direct they will vanish quickly.

And my version is patched for Debian, but for the same legal reason’s I neither can share them.

The core documentation is available at

http://www.aastra.com/xml-development-toolkit.htm

if you want to do your own version. The aastra-daemons , -1 and -2 might also need some work from the originals for newer versions of asterisk as the AMI has changed a fair bit.

I’m not looking to change the existing scripts, I’m just trying to change the scripts that I’ve created. For some reason I can’t get the xml to send any digits to the phone while it’s on a call. It worked fine with the older firmware and I can’t see anything in the development toolkit that would have changed regarding the commands I’m using. I’ve just kinda hit a wall and can’t seem to figure out what’s wrong.

How can anyone “. . .figure out what’s wrong . . .” if you post absolutely no details of what you want to do and how you are trying to do it? If you are using the AMI then just tailf a connection with appropriate rights to 5038.

I wasn’t planning on posting it here but I can. I was just checking to see if anyone is able to help. I’ve simplified the code to just one function and pulled out the rest to remove the complexity. It’s not AMI. It’s a button on the Aastra phone that transfers the call. When pressed, it shows a menu. That works. When the Menu option is pressed is shows the list of extensions. That works. You then scroll to the extension desired and press Select. It is here that it fails. It should transfer the call but it just scrolls to a random point in the list. Here it is.

<?php ############################################################################# # PHP customization for includes and warnings ############################################################################# $OS = strtolower(PHP_OS); if(strpos($OS, "win") === false) ini_set('include_path',ini_get('include_path').':include:../include'); else ini_set('include_path',ini_get('include_path').';include;..\include'); error_reporting(E_ERROR | E_PARSE); ############################################################################# # Includes ############################################################################# require_once('AastraAsterisk.php'); require_once('AastraAsterisk.class.php'); require_once('AastraCommon.php'); require_once('DB.php'); require_once('AastraIPPhoneExecute.class.php'); require_once('AastraIPPhoneTextMenu.class.php'); require_once('AastraIPPhoneTextScreen.class.php'); require_once('AastraIPPhoneFormattedTextScreen.class.php'); require_once('AastraIPPhoneStatus.class.php'); ############################################################################# # Pre code ############################################################################# # Retrieve parameters $USER=Aastra_getvar_safe('user'); $ORIGIN=Aastra_getvar_safe('origin'); $selection=Aastra_getvar_safe('selection'); $ACTION=Aastra_getvar_safe('ACTION','list'); # Trace Aastra_trace_call('directory_asterisk','user='.$USER); # Test User Agent Aastra_test_phone_versions(array('1'=>'1.4.2.','2'=>'1.4.2.','3'=>'2.5.3.','4'=>'2.5.3.','5'=>'3.0.1.'),'0'); # Get Language $LANGUAGE=Aastra_get_LANGUAGE(); # Save return URI $XML_SERVER.='?user='.$USER.'&origin='.$ORIGIN; # Compute MaxLines if($IS_SOFTKEYS) $MAXLINES=AASTRA_MAXLINES; else $MAXLINES=AASTRA_MAXLINES-2; # Get global compatibility $IS_SOFTKEYS=Aastra_is_softKEYs_supported(); $IS_ICONS=Aastra_is_icons_supported(); $IS_STYLE_TEXTMENU=Aastra_is_style_textmenu_supported(); ############################################################################# # Main Code ############################################################################# switch($ACTION) { case 'list': ##### Create Menu #### $OBJECT=new AastraIPPhoneTextMenu(); $OBJECT->setDestroyOnExit(); $OBJECT->setStyle('none'); $OBJECT->setWrapList(); $OBJECT->setTitle('Transfer To A(n):'); $OBJECT->addEntry('~Extension (Blind)',$XML_SERVER.'&ACTION=ext-blind'); $OBJECT->addSoftKey('1',Aastra_get_label('Select',$LANGUAGE),'SoftKey:Select'); $OBJECT->addSoftKey('2', 'Direct #', 'SoftKey:Xfer'); $OBJECT->addSoftKey('6',Aastra_get_label('Exit',$LANGUAGE), 'SoftKey:Exit'); break; case 'ext-blind': ##### Connect to AGI ##### $AS = new AGI_AsteriskManager(); $RES = $AS->connect(); $RAW=$AS->database_show('AMPUSER'); ##### Place Extensions 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); ##### Create Menu ##### $OBJECT=new AastraIPPhoneTextMenu(); $OBJECT->setDestroyOnExit(); $OBJECT->setStyle('none'); $OBJECT->setWrapList(); $OBJECT->setTitle('Select Extension:'); foreach($ARRSTORE as $KEY=>$VALUE) { $OBJECT->addEntry("~".$KEY,$XML_SERVER.'&ACTION=dial&selection='.$VALUE); } if(sizeof($ARRSTORE)==0) $OBJECT->addEntry("None Found",$XML_SERVER.'?ACTION=list&LOOKUP='.$LOOKUP); $OBJECT->addSoftKey('1',Aastra_get_label('Select',$LANGUAGE),'SoftKey:Select'); $OBJECT->addSoftKEY('4',Aastra_get_label('Back',$LANGUAGE),$XML_SERVER.'?ACTION=list&LOOKUP='.$LOOKUP); $OBJECT->addSoftKey('6',Aastra_get_label('Exit',$LANGUAGE), 'SoftKey:Exit'); break; case 'dial': $COUNT=strlen($selection); $INDEX=0; $OBJECT = new AastraIPPhoneExecute(); $OBJECT->addEntry('Key:Xfer') ; $INDEX=0; do { $OBJECT->addEntry('Key:KeyPad'.substr($selection,$INDEX,1)) ; $INDEX++; } while ($INDEX<=$COUNT) ; $OBJECT->addEntry('Key:Xfer') ; break; } # Output XML OBJECT $OBJECT->output(); exit(); ?>

Thanks for any pointers.

Well actually, under it all, it IS AMI, albeit through AGI, you still need to debug what your code is sending to asterisk.

I don’t think it gets that far. This is php processed by the phone. The phone can’t handle it properly or it doesn’t get sent to the phone and so nothing gets sent to the PBX AFAIK.

Altruism . . . .

You wrote the code, it doesn’t work, what you think is happening is really immaterial, what is actually happening is what you need to debug, there are the aastra daemons running, the underlying php classes that you are using, the code you wrote, each level depends on the underlying levels, ultimately if your code doesn’t talk to asterisk, then it just won’t work. You need to fix that.

Yes, I know it doesn’t work. That’s why I’m asking here. It worked with the old firmware but not with the new. I’ve looked at it off and on for quite some time now and I feel at this point it is quite obvious to myself I’m not going to figure it out without some help. Telling me that it doesn’t work so I need to fix it is rather belligerent (and far from Altruistic). What I think is happening is very material to the matter at hand. If I’m wrong about that then I’m troubleshooting the wrong stuff and have a fundamental misunderstanding about what is happening.

But since it is PHP I’ve tried putting in error trapping to text file and you know what I find? Nothing. Like the PHP isn’t being processed properly. If I remove the case statement and just make go straight to the transfer it works fine. Only when going through the case statement does it not work properly. That leads me to believe it’s a php parsing issue with the new Firmware.

Now, if you believe I should be looking elsewhere then please point me in the right direction. But telling me that my code is bad and I just need to fix it? I came here for help, not to be patronized.

Sorry if you find me belligerent. Good luck otherwise though.