adding a new line to deviceprofile

Version 1
    This document was generated from CDN thread

    Created by: irfan h on 01-03-2010 12:46:28 AM
    Hi,
     
    Can anyone suggest how to add a new line to deviceprofile/ Im using php and axl soap.
     
     
    Thanks
    IAH

    Subject: RE: adding a new line to deviceprofile
    Replied by: Anitha V on 01-03-2010 11:29:21 AM
    Hi Irfan,
     
    You could use 'addLine' request to add a new line to a device.
     
    Thanks,
    Anitha
     
     

    Subject: RE: adding a new line to deviceprofile
    Replied by: David Staudt on 01-03-2010 06:50:51 PM
    A device profile can be thought of as a 'virtual' phone device.  Working with a device profile via AXL is very similar to working with a regular phone device.  In order to add a line to a device profile, the sequence would be something like:
     
    - getDeviceProfile - Retrieve the current settings on the device profile, especially the <lines> list
    - addLine - If the line your adding does not already exist, use addLine to create one.  If successful, AXL returns the pkid of the new line.
    - Modify the <lines> list for the device profile, adding a new <line> element - note the 'dirn' should be the pkid returned from addLine above
    - updateDeviceProfile - Submit this request including the modified <lines> list.  The lines on the device profile will be replaced with the updated list.

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 01-03-2010 10:19:54 PM
    I'm doing exactly the same steps. I have tried to modify the lines but when I do updateDeviceProfile  I get an error message SoapFault exception: [SOAP-ENV:Client] No uuid or name element found. Could anyone help me with this one.
     
    This the request i'm sending to updateDeviceProfile .  $api->__soapCall('updateDeviceProfile',$request);
    where $request is:

    request:Array
    (
         => '{0AB392EB-EAFF-5CBF-B254-0B51BBFFA3A8}'
         => Array
            (
                 => Array
                    (
                        [0] => stdClass Object
                            (
                                 =>
                                 =>
                                 =>
                                 => stdClass Object
                                    (
                                         => {26ACCFAE-625B-BF94-7E74-056E723706A3}
                                    )

                                 => Use System Default
                                [consecutiveRingSetting] => Use System Default
                                [ringSettingIdlePickupAlert] => Use System Default
                                [ringSettingActivePickupAlert] => Use System Default
                                 =>
                                [e164Mask] =>
                                 => 0
                                 => Use System Policy
                                 => 4
                                 => 2
                                 => stdClass Object
                                    (
                                         => 1
                                         =>
                                         =>
                                         => 1
                                    )

                                 => Call Recording Disabled
                                 => Default
                                 =>
                                 => General
                                 => {422CBA8C-8CD9-3D8E-C1F7-B2E79B12532A}
                                 => 1
                            )

                        [1] => Array
                            (
                                 => DI Hotline
                                 => DI Hotline
                                 => DI Hotline
                                 => Array
                                    (
                                         => {B42CED18-652C-D3FE-0DEC-EA6325C6F791}
                                         => 2907
                                    )

                                 => Use System Default
                                [consecutiveRingSetting] => Use System Default
                                 => DI Hotline
                                [e164Mask] => 029296XXXX
                                 => 0
                                 => Use System Policy
                                 => 4
                                 => 4
                                 => Array
                                    (
                                         => true
                                         => true
                                         => false
                                         => true
                                    )

                                 => 6
                            )

                    )

            )

    )

    Subject: RE: adding a new line to deviceprofile
    Replied by: David Staudt on 01-03-2010 11:13:27 PM
    It may be helpful to look at the XML being sent (if you can get PHP to dump it) or the AXL logs from UCM (via the RTMT tool) - which will have the XML of the request logged.  Sometimes you can spot obvious errors in the XML itself that are not so obvious in the native code.
     
    Please attach the XML request or AXL logs here if you can't spot anything.  Please also confirm the UCM version you are using.
     
    It may also be helpful if you can post (via attach) a small sample app that demonstrates your code and problem.

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 01-03-2010 11:36:19 PM
    Hi David,
     I'm using UCM V7. This is the xml request being sent .
    <?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/7.0"><SOAP-ENV:Body><ns1:updateDeviceProfile/><param1><item><key>line</key><value><label></label><asciiLabel></asciiLabel><display></display><dirn><uuid>{26ACCFAE-625B-BF94-7E74-056E723706A3}</uuid></dirn><ringSetting>Use
    System Default</ringSetting><consecutiveRingSetting>Use
    System
    Default</consecutiveRingSetting><ringSettingIdlePickupAlert>Use
    System
    Default</ringSettingIdlePickupAlert><ringSettingActivePickupAlert>Use
    System
    Default</ringSettingActivePickupAlert><displayASCII></displayASCII><e164Mask></e164Mask><dialPlanWizardId>0</dialPlanWizardId><mwlPolicy>Use
    System
    Policy</mwlPolicy><maxNumCalls>4</maxNumCalls><busyTrigger>2</busyTrigger><callInfoDisplay><callerName>true</callerName><callerNumber>false</callerNumber><redirectedNumber>false</redirectedNumber><dialedNumber>true</dialedNumber></callInfoDisplay><recordingFlag>Call
    Recording
    Disabled</recordingFlag><audibleMWI>Default</audibleMWI><speedDial></speedDial><partitionUsage>General</partitionUsage><uuid>{422CBA8C-8CD9-3D8E-C1F7-B2E79B12532A}</uuid><index>1</index></value></item></param1></SOAP-ENV:Body></SOAP-ENV:Envelope>
     
     
    I dont see the uuid being passed although I'm sending in the api call.
    $api->__soapCall('updateDeviceProfile',array('uuid' => $deviceId, 'lines' => array('line' => $lines)));
     
     I'm attaching a sample code.

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 02-03-2010 02:27:09 AM
    Hi David,
     
    I did a print out of the variables and it seems to be present. This is really making crazy.
    <pre>request:Array
    (
         => {0AB392EB-EAFF-5CBF-B254-0B51BBFFA3A8}
         => Array
            (
                 => Array
                    (
                        [0] => stdClass Object
                            (
                                 =>
                                 =>
                                 =>
                                 => stdClass Object
                                    (
                                         => {26ACCFAE-625B-BF94-7E74-056E723706A3}
                                    )

                                 => Use System Default
                                [consecutiveRingSetting] => Use System Default
                                [ringSettingIdlePickupAlert] => Use System Default
                                [ringSettingActivePickupAlert] => Use System Default
                                 =>
                                [e164Mask] =>
                                 => 0
                                 => Use System Policy
                                 => 4
                                 => 2
                                 => stdClass Object
                                    (
                                         => 1
                                         =>
                                         =>
                                         => 1
                                    )

                                 => Call Recording Disabled
                                 => Default
                                 =>
                                 => General
                                 => {422CBA8C-8CD9-3D8E-C1F7-B2E79B12532A}
                                 => 1
                            )

                        [1] => Array
                            (
                                 => DI Hotline
                                 => DI Hotline
                                 => DI Hotline
                                 => Array
                                    (
                                         => {B42CED18-652C-D3FE-0DEC-EA6325C6F791}
                                         => 2907
                                    )

                                 => Use System Default
                                [consecutiveRingSetting] => Use System Default
                                 => DI Hotline
                                [e164Mask] => 029296XXXX
                                 => 0
                                 => Use System Policy
                                 => 4
                                 => 4
                                 => Array
                                    (
                                         => true
                                         => true
                                         => false
                                         => true
                                    )

                                 => 6
                            )

                    )

            )

    )
    </pre>

    Subject: RE: adding a new line to deviceprofile
    Replied by: David Staudt on 02-03-2010 01:59:50 AM
    Right at the top of the actual XML you can see:
     
    {code}
    <SOAP-ENV:Body><ns1:updateDeviceProfile/>
    {code}
     
    Notice the terminating slash, PHP thinks the entire object is null and is sticking the 'lines' object on the tail (for some reason) as an unknown parameter.
     
    I would suggest that the variables you are collecting/filling, such as $lines, and $deviceId,  may be null or may not contain what you think they do.  You may want to step-into/debug/print out the contents of these variables to inspect their values.

    Subject: RE: adding a new line to deviceprofile
    Replied by: David Staudt on 02-03-2010 04:03:23 AM
    Out of curiosity, why are you using __soapcall to do the final request?  Does this provide better debugging?
     
    Looking at the SoapClient docs for __soapcall, the second parameter is supposed to be an array of parameters (and there is only one parameter, which is itself an array, so I think maybe you need one more layer of array():
     
    <pre>__soapCall('updateDeviceProfile',array(array($param1, $param2)))

    This is kind of borne out by the XML request it is generating.</pre>

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 02-03-2010 02:38:11 AM
    Made some changes to the script . Now i'm getting this:
     
    <?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/7.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><ns1:updateDeviceProfile><uuid>{0AB392EB-EAFF-5CBF-B254-0B51BBFFA3A8}</uuid></ns1:updateDeviceProfile><param1><item><key>lines</key><value><item><key>line</key><value><xsd:anyType><label></label><asciiLabel></asciiLabel><display></display><dirn><uuid>{26ACCFAE-625B-BF94-7E74-056E723706A3}</uuid></dirn><ringSetting>Use
    System Default</ringSetting><consecutiveRingSetting>Use
    System
    Default</consecutiveRingSetting><ringSettingIdlePickupAlert>Use
    System
    Default</ringSettingIdlePickupAlert><ringSettingActivePickupAlert>Use
    System
    Default</ringSettingActivePickupAlert><displayASCII></displayASCII><e164Mask></e164Mask><dialPlanWizardId>0</dialPlanWizardId><mwlPolicy>Use
    System
    Policy</mwlPolicy><maxNumCalls>4</maxNumCalls><busyTrigger>2</busyTrigger><callInfoDisplay><callerName>true</callerName><callerNumber>false</callerNumber><redirectedNumber>false</redirectedNumber><dialedNumber>true</dialedNumber></callInfoDisplay><recordingFlag>Call
    Recording
    Disabled</recordingFlag><audibleMWI>Default</audibleMWI><speedDial></speedDial><partitionUsage>General</partitionUsage><uuid>{422CBA8C-8CD9-3D8E-C1F7-B2E79B12532A}</uuid><index>1</index></xsd:anyType><xsd:anyType><item><key>label</key><value>DI
    Hotline</value></item><item><key>asciiLabel</key><value>DI
    Hotline</value></item><item><key>display</key><value>DI
    Hotline</value></item><item><key>dirn</key><value><item><key>uuid</key><value>{B42CED18-652C-D3FE-0DEC-EA6325C6F791}</value></item><item><key>pattern</key><value>2907</value></item></value></item><item><key>ringSetting</key><value>Use
    System
    Default</value></item><item><key>consecutiveRingSetting</key><value>Use
    System
    Default</value></item><item><key>displayASCII</key><value>DI
    Hotline</value></item><item><key>e164Mask</key><value>029296XXXX</value></item><item><key>dialPlanWizardId</key><value>0</value></item><item><key>mwlPolicy</key><value>Use
    System
    Policy</value></item><item><key>maxNumCalls</key><value>4</value></item><item><key>busyTrigger</key><value>4</value></item><item><key>callInfoDisplay</key><value><item><key>callerName</key><value>true</value></item><item><key>callerNumber</key><value>true</value></item><item><key>redirectedNumber</key><value>false</value></item><item><key>dialedNumber</key><value>true</value></item></value></item><item><key>index</key><value>6</value></item></xsd:anyType></value></item></value></item></param1></SOAP-ENV:Body></SOAP-ENV:Envelope>

     
    I've attached the php script .

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 02-03-2010 04:12:46 AM
    __soapCall spits out the xml before sending out the actual request. If you look at the soap_debug.php , you'll understand what I mean.  I tried __soapCall('updateDeviceProfile',array(array($param1, $param2))) but end up getting:
    SoapFault exception:  SOAP-ERROR: Encoding: object hasn't 'pattern' property
     
    Any suggestions?
     
    Thanks
    IAH

    Subject: RE: adding a new line to deviceprofile
    Replied by: irfan h on 04-03-2010 02:00:34 AM
    Anyway the problem is solved now. the dirn object in the lines object needs the pattern property set.