cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1660
Views
5
Helpful
2
Replies

AXL SOAP updatePhone with multiple lines in PHP

davidtilman
Level 1
Level 1

I am having trouble using the AXL SOAP updatePhone with PHP to update line information on a phone with multiple lines. I have looked for examples online to update multiple lines in PHP, but haven't found any examples. I am using PHP 5.6.20 and CUCUM 10.5.1. Here is the test code that I am using:

class PhoneLine {

    public $index;

    public $label;

    public $dirn;

    public $recordingMediaSource;

}

$phoneLine1 = new PhoneLine();

$phoneLine1->index = '1';

$phoneLine1->label = 'test label';

$phoneLine1->recordingMediaSource = 'Gatewary Preferred';

$phoneLine1->dirn = ['pattern'=>'1521', 'routePartitionName'=>'LabInternal'];

$phone = array(

    'name'=>'SEP001100110011',

    'lines'=>array(

        $phoneLine1

    )

);

$response = $soapconnect->updatePhone($phone);

$lastRequest = $soapconnect->__getLastRequest();

$lastRequest shows lines as empty:

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cisco.com/AXL/API/10.5">

  <SOAP-ENV:Body>

  <ns1:updatePhone>

  <name>SEP001100110011</name>

  <lines/>

  </ns1:updatePhone>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

But if I change the code to add a "line" key to the element, it works:

$phone = array(

    'name'=>'SEP001100110011',

    'lines'=>array(

        'line'=>$phoneLine1

    )

);

Here is $lastRequest with the change:

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cisco.com/AXL/API/10.5">

  <SOAP-ENV:Body>

  <ns1:updatePhone>

  <name>SEP001100110011</name>

  <lines>

  <line>

  <index>1</index>

  <label>test label</label>

  <dirn>

  <pattern>1521</pattern>

  <routePartitionName>LabInternal</routePartitionName>

  </dirn>

  <recordingMediaSource>Gatewary Preferred</recordingMediaSource>

  </line>

  </lines>

  </ns1:updatePhone>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

The problem is that you can't have a key of "line" for multiple elements in an array or object in PHP, so I can't have a second line added. I am using the same technique as shown in the Cisco AXL PHP documentation (https://developer.cisco.com/site/axl/learn/tutorials/axp-php-primer/index.gsp#complete-adduser-code-sample), which seems to indicate that the request should work without having the "line" key.

I have been able to get other groups of info to update properly with multiple entries with the same technique (without the key) like speed dials, but not lines. How should I update line information on a phone with multiple lines?

1 Accepted Solution

Accepted Solutions

Thanks for the reply. I was just about to post that I found the answer today. It turns out I needed to change the structure slightly, so that the array of lines was within the "line" element instead of the "lines" element. Basically adding one more nested array. This test code below works for me now:

$phone =  [

    'name' => $phoneName,

    'lines' => [

        'line' => [

            [

                'index' => '1',

                'label' => 'test label 1',

                'recordingMediaSource' => 'Gatewary Preferred',

                'dirn' => [

                    'pattern' => '1521',

                    'routePartitionName' => 'LabInternal'

                ]

            ],

            [

                'index' => '2',

                'label' => 'test label 2',

                'recordingMediaSource' => 'Gatewary Preferred',

                'dirn' => [

                    'pattern' => '1522',

                    'routePartitionName' => 'LabInternal'

                ]

            ]

        ]

    ]

];

$response = $soapconnect->updatePhone($phone);

$lastRequest = $soapconnect->__getLastRequest();

View solution in original post

2 Replies 2

dstaudt
Cisco Employee
Cisco Employee

Didyou try changing the class name from 'PhoneLine' to 'line'..?

Thanks for the reply. I was just about to post that I found the answer today. It turns out I needed to change the structure slightly, so that the array of lines was within the "line" element instead of the "lines" element. Basically adding one more nested array. This test code below works for me now:

$phone =  [

    'name' => $phoneName,

    'lines' => [

        'line' => [

            [

                'index' => '1',

                'label' => 'test label 1',

                'recordingMediaSource' => 'Gatewary Preferred',

                'dirn' => [

                    'pattern' => '1521',

                    'routePartitionName' => 'LabInternal'

                ]

            ],

            [

                'index' => '2',

                'label' => 'test label 2',

                'recordingMediaSource' => 'Gatewary Preferred',

                'dirn' => [

                    'pattern' => '1522',

                    'routePartitionName' => 'LabInternal'

                ]

            ]

        ]

    ]

];

$response = $soapconnect->updatePhone($phone);

$lastRequest = $soapconnect->__getLastRequest();

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: