cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
728
Views
0
Helpful
1
Replies

AXL with PHP (updateLineGroup)

Nsaneone1
Level 1
Level 1

Good Afternoon All, 

Apologies for disturbing. Wanted to request assistance with the following issue I have. I'm using PHP along with AXLAPI.wsdl file to communicate with our Call Manager System (11.5). Up until now have been having good results, however I have hit a snag with attempting to update LineGroup members using the updateLineGroup method available in the wsdl file. 

 

With PHP I setup an associative array with all the required parameters. For Example

$client->updateLineGroup(array("name"=>"TestLineGroup","newName"=>"RenamedLineGroup"))

 

The above works successfully, and I can update all the settings of the line group, except members. 

 

Looking at the documentation, I can see that this requires LineSelectionOrder and directoryNumber. I tried the following: 

 

$directoryNumber = array("pattern"=>"1234","routePartitionName"=>"Internal");

$member = array("lineSelectionOrder"=>"0","directoryNumber"=>$directoryNumber);

$params = array("name"=>$linegroup,"members"=>$member);

 

$client->updateLineGroup($params)

 

The above returns the GUID of the Line Group like in all successful operations however no members are added. Even when I set the members to an empty array (thinking this should remove all members), the membership remains the same. Its like "members" is just ignored completely. Any assistance would be appreciated. Thank you

1 Reply 1

Nsaneone1
Level 1
Level 1

Thankfully, finally resolved this issue. David Staudt was able to offer a suitable direction to investigate. Looking at the body of the soap request after PHP had sent it, it was indeed stripping out the <members>. So for example my request would be to clear all members for a Linegroup $request = array("Name"=>"TestGroup","members"=>""). Regardless what happened the soap request would never contain the Members tag. 

 

To resolve this I did the following I had to use SoapVar to construct the soap request. 

 

$members = new SoapVar('', SOAP_ENC_OBJECT, null, null, 'members' );
$name = new SoapVar($linegroup, XSD_STRING, null, null, 'name' );

$updatelinereq = new SoapVar(array($name,$members),SOAP_ENC_OBJECT,null,null,'updateLineGroup');
 
$req = $client->updateLineGroup($updatelinereq);
 
The above would show the members tag, and effectively remove all members from the Linegroup provided. 
 
To add a selection of members I had to construct two classes.
 
class member {
public $lineSelectionOrder;
public $directoryNumber;
};

class directoryNumber {
public $pattern;
public $routePartitionName;
};
 
foreach($linegroupMember as $line){

$current = new member();

$current->lineSelectionOrder = $line['selectionorder'];
$current->directoryNumber = new directoryNumber();
 
$current->directoryNumber->pattern = $line['dnorpattern'];
$current->directoryNumber->routePartitionName = 'Partition';
 
$current_member = new SoapVar($current, SOAP_ENC_OBJECT, null, null, 'member');

$members[] = $current_member;

}
 
Then finally the request was the same as above expect using the $members array. 
 
$members = new SoapVar($members, SOAP_ENC_OBJECT, null, null, 'members' );
$name = new SoapVar($linegroup, XSD_STRING, null, null, 'name' );

$updatelinereq = new SoapVar(array($name,$members),SOAP_ENC_OBJECT,null,null,'updateLineGroup');
$req = $client->updateLineGroup($updatelinereq);
 
I truly hopes this helps someone. Knowing where to look helped a great deal. I thought It was a problem with the WSDL, but it was infact PHP not using all the information provided. 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: