cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4264
Views
7
Helpful
15
Replies

updatePhone line property 10.5

JacobMunson
Level 1
Level 1

hello all,

I am trying to update a line on a phone using updatePhone however looking at the AXL logs it looks like CUCM is dropping the line part of the xml that I am sending. I want to add an associated user to a line andas far as I know the only way to do this is using updatePhone. I see that others are having issues with the updatePhone addline and remove line options and I am wondering if anyone else is having issues with updating a line on a phone?

Thank you

15 Replies 15

npetrele
Cisco Employee
Cisco Employee

Are you adding a new line <addLines>, or are you modifying an existing line <lines> with your updatePhone operation?

I am trying to modify the associatedEndusers field of an existing line on a phone  using the updatePhone operation.

Can you post an example of your request XML?  The following worked fine for me:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.5">

   <soapenv:Header/>

   <soapenv:Body>

      <ns:updatePhone sequence="?">

         <name>Pomeroy</name>

         <lines>

            <line>

               <index>1</index>

               <dirn>

                  <pattern>3535</pattern>

                  <routePartitionName></routePartitionName>

               </dirn>

               <associatedEndusers>

                  <enduser>

                     <userId>nicholas</userId>

                  </enduser>

               </associatedEndusers>

            </line>

         </lines>

      </ns:updatePhone>

   </soapenv:Body>

</soapenv:Envelope>

Unfortunately I am sending the updatePhone operation using php so I am not sure how i can show the actual XML request.

Here is my php code

$UserInfo['UID']  = userID


  try {

  $response = $client->updatePhone(

array("uuid"=> $phoneuuid,

  "ownerUserName"=> $UserInfo['UID'],

  "lines"=>array("line"=>array(

  "index"=>"1",

  "dirn"=>array(

  "uuid"=>$lineuuid),

  "e164Mask"=>"0000000000",

  "associatedEndusers"=>array("enduser"=>array("userId"=>$UserInfo['UID']))))));

  } catch (SoapFault $fault) {

  $log['update phone'] = $fault;

  }

  }

as you can see I was trying to change the external number mask to 0000000000 just to see if the line was getting updated and even that was getting ignored. Here is the output of from CUCM logs of this request

<?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>

<uuid>{256F5C76-9F6B-F107-F6D1-C9D86C88F067}</uuid>

<ownerUserName>jmunson</ownerUserName>

</ns1:updatePhone>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

as you can see the entire Lines section was dropped somehow.

The problem is in your PHP (or in the way the PHP Soap client is interpreting the WSDL).  Try something like this replacement for the soap client below. I set the parameters like this:

$client->sendRequest = false;

$client->printRequest = true;

$client->formatXML = true;

This tells the client not to actually send the soap request, just create the XML and display it.  That will show you what XML is going to the server.  When i formatted my request similar to how you set up yours, this was what the XML looked like:

<?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>Pomeroy</name>

     </ns1:updatePhone>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>


Notice that it's missing all of the information except the phone name.

=============== code =================

class MySoapClient extends SoapClient {

  public $sendRequest = true;

  public $printRequest = false;

  public $formatXML = false;

  public function __doRequest($request, $location, $action, $version, $one_way = 0) {

       if ($this->printRequest) {

            if (!$this->formatXML) {

                 $out = $request;

            } else {

                 $doc = new DOMDocument;

                 $doc->preserveWhiteSpace = false;

                 $doc->loadxml($request);

                 $doc->formatOutput = true;

                 $out = $doc->savexml();

            }

            echo "<pre>";

            echo htmlspecialchars($out);

            echo "</pre>";

       }

       if ($this->sendRequest) {

            return parent::__doRequest($request, $location, $action, $version, $one_way);

       } else {

            return '';

       }

  }

}

$clientClass = 'MySoapClient';

$client = new $clientClass("the wsdl",

  array('trace'=>true,

   'exceptions'=>true,

   'location'=>"https://yourserver:8443/axl",

   'login'=>'username',

   'password'=>'password',

));

$client->sendRequest = false;

$client->printRequest = true;

$client->formatXML = true;

... your updatePhone code ...


Nicholas,

Thank you for all the help. I was able to get my code to output the XML per your example however for the life of me I can't get the lines portion of the updatePhones operation to show up. Have you used this before?

My understanding of the updatePhones operation AXL schema is as follows however I am either reading it wrong or there is a bug. if you could confirm i am reading it correctly the would be much appreciated.

updatePhone->lines->line->{line elements}

if there are multiple lines on a phone it would look like

updatePhone->lines->line->1->{line elements}

it almost seems like the addition of removeLines & addLines as well as the lineIdentifier within the updatePhones operation has caused issues with calling the line.

Does anyone have a working example of updating a device specific line element?

I feel your pain.

I use PHP/AXL quite a bit.  I am the one who wrote the tutorials on PHP and AXL in the Learn section on Devnet.  But there are a lot of operations I've only been able to get working through tedious trial and error.  The PHP Soap handling is generally easy and powerful, but figuring out what data to send in the Soap call can sometimes be a nightmare, and the WSDL isn't much help.  I played with this particular problem (updatePhone and lines) for a couple hours and got nowhere.  Well, that's not entirely true.  I got it to send add the line data to the XML, but with the wrong parent tag.  Don't ask me what I did to get that, because I'm several versions beyond that now, and it's still not working.  But one of the approaches I tried was to define the tags as classes rather than arrays.

For example:

class line
{
public $index;
public $dirn;
public $associatedEndusers;
}
class dirn
{
public $pattern;
}

And so on.  But still no luck.

Unfortunately, if this is a bug, it's most likely a bug in the way PHP Soap interprets and uses the WSDL.  I've seen this kind of thing before with Python, and the solution was to upgrade to a beta version of the Python library.  I don't know if that's possible with PHP Soap.  But SoapUI uses the same exact WSDL to discover the XML and has no problem with the updatePhone operation. So it's not a bug in the WSDL, and it's not a bug in CUCM/AXL. 

As a last resort, or perhaps as a workaround if you can't make it work any other way, you might try constructing the Soap request at a more bare bones level, using things like SoapParam, SoapVar, and SoapHeader.  Done right, that pretty much forces the XML to be correct.  It's a pain, I know, but it may be the only option if we don't discover any hidden secret method we're missing to making the regular client call work.

By the way, try these operations to have a look at how PHP is interpreting the WSDL.  Personally, I didn't find that this helped much, but maybe you'll spot something I missed, or even spot where PHP is not interpreting the WSDL correctly:

echo "<H1>Functions</H1><BR><BR>";

echo "<pre>";
var_dump($client->__getFunctions());
echo "</pre>";

echo "<BR><HR><BR>";
echo "<H1>Types</H1><BR><BR>";

echo "<pre>";
var_dump($client->__getTypes());
echo "</pre>";

Here's the key type information for updatePhone:

  [1148]=>

  string(3538) "struct UpdatePhoneReq {

UniqueString128 newName;

String128 description;

XFkType callingSearchSpaceName;

XFkType devicePoolName;

XFkType commonDeviceConfigName;

XFkType commonPhoneConfigName;

XNetworkLocation networkLocation;

XFkType locationName;

XFkType mediaResourceListName;

XMOHAudioSourceId networkHoldMohAudioSourceId;

XMOHAudioSourceId userHoldMohAudioSourceId;

XFkType automatedAlternateRoutingCssName;

XFkType aarNeighborhoodName;

XLoadInformation loadInformation;

XVendorConfig vendorConfig;

String128 versionStamp;

boolean traceFlag;

String128 mlppDomainId;

XStatus mlppIndicationStatus;

XPreemption preemption;

XStatus useTrustedRelayPoint;

boolean retryVideoCallAsAudio;

XFkType securityProfileName;

XFkType sipProfileName;

XFkType cgpnTransformationCssName;

boolean useDevicePoolCgpnTransformCss;

XFkType geoLocationName;

XFkType geoLocationFilterName;

boolean sendGeoLocation;

removeLines removeLines;

addLines addLines;

lines lines;

XFkType phoneTemplateName;

speeddials speeddials;

busyLampFields busyLampFields;

XFkType primaryPhoneName;

XStatus ringSettingIdleBlfAudibleAlert;

XStatus ringSettingBusyBlfAudibleAlert;

blfDirectedCallParks blfDirectedCallParks;

addOnModules addOnModules;

XUserLocale userLocale;

XCountry networkLocale;

XInteger idleTimeout;

string authenticationUrl;

string directoryUrl;

string idleUrl;

string informationUrl;

string messagesUrl;

string proxyServerUrl;

string servicesUrl;

services services;

XFkType softkeyTemplateName;

XFkType defaultProfileName;

boolean enableExtensionMobility;

XBarge singleButtonBarge;

XStatus joinAcrossLines;

XStatus builtInBridgeStatus;

XStatus callInfoPrivacyStatus;

XStatus hlogStatus;

XFkType ownerUserName;

boolean ignorePresentationIndicators;

XPacketCaptureMode packetCaptureMode;

XInteger packetCaptureDuration;

XFkType subscribeCallingSearchSpaceName;

XFkType rerouteCallingSearchSpaceName;

boolean allowCtiControlFlag;

XFkType presenceGroupName;

boolean unattendedPort;

boolean requireDtmfReception;

boolean rfc2833Disabled;

XCertificateOperation certificateOperation;

XAuthenticationMode authenticationMode;

XKeySize keySize;

String128 authenticationString;

string upgradeFinishTime;

XStatus deviceMobilityMode;

boolean remoteDevice;

XDNDOption dndOption;

XRingSetting dndRingSetting;

boolean dndStatus;

boolean isActive;

XFkType mobilityUserIdName;

XPhonePersonalization phoneSuite;

XPhoneServiceDisplay phoneServiceDisplay;

boolean isProtected;

boolean mtpRequired;

XSIPCodec mtpPreferedCodec;

XFkType dialRulesName;

String50 sshUserId;

String255 sshPwd;

String255 digestUser;

XOutboundCallRollover outboundCallRollover;

boolean hotlineDevice;

String255 secureInformationUrl;

String255 secureDirectoryUrl;

String255 secureMessageUrl;

String255 secureServicesUrl;

String255 secureAuthenticationUrl;

String255 secureIdleUrl;

XStatus alwaysUsePrimeLine;

XStatus alwaysUsePrimeLineForVoiceMessage;

XFkType featureControlPolicy;

XDeviceTrustMode deviceTrustMode;

boolean earlyOfferSupportForVoiceCall;

boolean requireThirdPartyRegistration;

boolean blockIncomingCallsWhenRoaming;

string homeNetworkId;

boolean AllowPresentationSharingUsingBfcp;

confidentialAccess confidentialAccess;

boolean requireOffPremiseLocation;

boolean allowiXApplicableMedia;

XFkType cgpnIngressDN;

boolean useDevicePoolCgpnIngressDN;

String128 msisdn;

boolean enableCallRoutingToRdWhenNoneIsActive;

XFkType wifiHotspotProfile;

XFkType wirelessLanProfileGroup;

}"

Here's another tip. Run something like this:

$payload = array("name"=>"name-of-phone");

$response = $client->getPhone($payload);

echo "<pre>";
var_dump(get_object_vars($response));
echo "</pre>";

This will return and display the whole set of objects and strings for the phone.  This might serve as a guide on how to construct the object you need to send to updatePhone.

nkleven
Level 4
Level 4

Did you get this working?  I am having the same problem.

ktvrind01
Level 1
Level 1

There is an error in the AXLSoap xsd file. Addlines and removeLines are added as methods. Checked on CUCM version 11.5.

Look for the updatePhoneReq secion and move the </xsd:sequence> tag below the lines section:

<xsd:choice minOccurs="0">
  <xsd:sequence minOccurs="0">
  <xsd:element maxOccurs="1" minOccurs="0" name="removeLines">
  <xsd:complexType>
  <xsd:choice minOccurs="1">
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="line" type="axlapi:XPhoneLine">
  <xsd:annotation>
  <xsd:documentation>An XLine is an entry in the DeviceNumPlanMap table. The actual directory number is referenced inside the XLine object by the "dirn" or "dirnId" element.</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="lineIdentifier" type="axlapi:XNumplanIdentifier">
  <xsd:annotation>
  <xsd:documentation>The lineIdentifier cannot be used with AddLines and RemoveLines.This tag is valid only for lines tag</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  </xsd:choice>
  </xsd:complexType>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="addLines">
  <xsd:complexType>
  <xsd:choice minOccurs="1">
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="line" type="axlapi:XPhoneLine">
  <xsd:annotation>
  <xsd:documentation>An XLine is an entry in the DeviceNumPlanMap table. The actual directory number is referenced inside the XLine object by the "dirn" or "dirnId" element.</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="lineIdentifier" type="axlapi:XNumplanIdentifier">
  <xsd:annotation>
  <xsd:documentation>The lineIdentifier cannot be used with AddLines and RemoveLines.This tag is valid only for lines tag</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  </xsd:choice>
  </xsd:complexType>
  </xsd:element>
  <xsd:element maxOccurs="1" minOccurs="0" name="lines">
  <xsd:complexType>
  <xsd:choice minOccurs="1">
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="line" type="axlapi:XPhoneLine">
  <xsd:annotation>
  <xsd:documentation>An XLine is an entry in the DeviceNumPlanMap table. The actual directory number is referenced inside the XLine object by the "dirn" or "dirnId" element.</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  <xsd:element maxOccurs="unbounded" minOccurs="1" name="lineIdentifier" type="axlapi:XNumplanIdentifier">
  <xsd:annotation>
  <xsd:documentation>The lineIdentifier cannot be used with AddLines and RemoveLines.This tag is valid only for lines tag</xsd:documentation>
  </xsd:annotation>
  </xsd:element>
  </xsd:choice>
  </xsd:complexType>
  </xsd:element>
</xsd:sequence>
</xsd:choice>



I seem to have been able to get <updatePhone> with an <addLines> list to work on 10.5, below:

  $result = $client->updatePhone( array(

      "name"=>"CSFDSTAUDT",

      "addLines"=>array(

        "line"=>array(

/*          "dirn"=>new SoapVar('<dirn uuid="{BD4E6306-4278-8CF5-157E-0A07C43EF429}"/>',XSD_ANYXML), */

          "dirn"=>array(

            "pattern"=>"1000",

            "routePartitionName"

          ),

          "index"=>1,

          "recordingMediaSource"=>"Gateway Preferred"

        )

      ) 

    )

  );

Note, the commented format if you want to use line dirn uuid instead of pattern+routePartitioName.  This probably could be cleaned up somewhat.

A quirk exists in that <recordingMediaSource> is marked as 'required' in the 10.5 WSDL schema, and CUCM does not allow this value to be present with a nil value - hence the example shows the default value of 'Gateway Preferred' being given.  This situation appears to have been changed 11.5 WSDL schema where the <recordingMediaSource> value is 'optional' altogether, and can be ommitted.

The <lines> set is filterd in the new wsdl/xsd. addLines and removeLines will work in the update but setting a set of lines is filterd out because of the error in the xsd.

Tip: wsdl files can be cached on disk. If the remove the cached wsdl files from the temp folder if wsdl_cache is set to WSDL_CACHE_DISK or WSDL_CACHE_BOTH

As crazy as it sounds...

We have 12.5 and I could not get $response->return->phone->lines->line->dirn->pattern to return the dn on the device I was querying.

 

I modified the AXLSoap.xsd as suggested and I believe it has fixed my getPhone query as well.

 

Thanks for taking the time to research this and providing an answer...

b

here's my snippet...

 

$response = $client->getPhone(<devicename>);
echo("Device Name: " $response->return->phone->name"<br>";
echo("Extension/DN: " $response->return->phone->lines->line->dirn->pattern"<br>";