Associating a line with a phone?

Version 1
    This document was generated from CDN thread

    Created by: Alex Arwine on 10-10-2008 10:12:59 PM
    Working on functions to create a line, update a line and associate a line.

    I see no way to associate a line. Is there no soap function to do this?

    Is sql the only option?
    Call me old fashioned but that seems like a hack.

    I'll take whatever I can get though, how would you suggest associating a line to a phone?

    Thanks!
    -Alex

    Subject: Re: Associating a line with a phone?
    Replied by: David Staudt on 11-10-2008 01:05:40 AM
    updatePhone is the correct request. Any lines which should be associated to the phone should be present in the Lines list. Note that the Lines list should reflect all lines...if you submit updatePhone with only one line, then any other lines will be removed. You will want to get the list of existing lines on the phone via getPhone, add/remove the line in question, then submit updatePhone with the modified list.

    Subject: Re: Associating a line with a phone?
    Replied by: Alex Arwine on 13-10-2008 05:55:52 PM
    Sounds good - However upon looking at the response I get from getphone() I can't seem to see which lines are associated
    This seems like the presumably relevant information:
    Is the uuid the uuid of the line? - If so how would I translate that to the DN?
    The DNs associated with the phone are 5150 and 3301

    </line><line index="1" uuid="{F0DA20C7-07B8-C85E-2059-9427526D7CC1}"><label/><display>Alex Arwine</display><dirn uuid="{7CEFB9B0-3978-4ECE-95D6-E9ECE7DE05DC}"/><ringSetting>Use System Default</ringSetting><consecutiveRingSetting>Use System Default</consecutiveRingSetting><ringSettingIdlePickupAlert>Use System Default</ringSettingIdlePickupAlert><ringSettingActivePickupAlert>Use System Default</ringSettingActivePickupAlert><displayASCII>Alex Arwine</displayASCII><e164Mask>3603305XXX</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><recordingProfileName/><monitoringCSSName/><recordingFlagName>Call Recording Disabled</recordingFlagName><audibleMWI>Default</audibleMWI><speedDial/><partitionUsage>General</partitionUsage><associatedEndusers/></line></lines><numberOfButtons>2</numberOfButtons>


    Thanks!
    -Alex

    Below is the entire response from getphone()


    string(6923) "<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:getPhoneResponse xmlns:axl="http://www.cisco.com/AXL/API/1.0" xmlns:xsi="http://www.cisco.com/AXL/API/1.0"><return><device ctiid="1199" uuid="{7FB555F7-5ADD-408F-8F38-C997937938D5}"><name>SEP00120101024A</name><description>Alex Arwine</description><product>Cisco 7940</product><model>Cisco 7940</model><class>Phone</class><protocol>SCCP</protocol><protocolSide>User</protocolSide><callingSearchSpaceName>LosAngeles-USA</callingSearchSpaceName><devicePoolName>SP_DP</devicePoolName><locationName>Los Angeles</locationName><mediaResourceListName>Los Angeles Office</mediaResourceListName><networkHoldMOHAudioSourceId>0</networkHoldMOHAudioSourceId><userHoldMOHAudioSourceId>0</userHoldMOHAudioSourceId><automatedAlternateRoutingCSSName/><loadInformation special="false">P00308000900</loadInformation><vendorConfig><disableSpeaker>false</disableSpeaker><disableSpeakerAndHeadset>false</disableSpeakerAndHeadset><pcPort>0</pcPort><settingsAccess>1</settingsAccess><garp>0</garp><voiceVlanAccess>0</voiceVlanAccess><videoCapability>0</videoCapability><autoSelectLineEnable>0</autoSelectLineEnable><webAccess>0</webAccess></vendorConfig><versionStamp>{1218563179-5ED9E09C-AF44-44D9-9872-023E19A30B7A}</versionStamp><traceFlag>false</traceFlag><mlppDomainId>-1</mlppDomainId><mlppIndicationStatus>Default</mlppIndicationStatus><preemption>Default</preemption><retryVideoCallAsAudio>true</retryVideoCallAsAudio><securityProfileName>Security Profile-2</securityProfileName><associatedPC/><lines><line index="2" uuid="{61B62FCB-D20C-535B-82AB-0BFC4E3FA377}"><label/><display/><dirn uuid="{6FDBE061-5BC0-35EA-EBDB-FBFCCC13001D}"/><ringSetting>Use System Default</ringSetting><consecutiveRingSetting>Use System Default</consecutiveRingSetting><ringSettingIdlePickupAlert>Use System Default</ringSettingIdlePickupAlert><ringSettingActivePickupAlert>Use System Default</ringSettingActivePickupAlert><displayASCII/><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><recordingProfileName/><monitoringCSSName/><recordingFlagName>Call Recording Disabled</recordingFlagName><audibleMWI>Default</audibleMWI><speedDial/><partitionUsage>General</partitionUsage><associatedEndusers/></line><line index="1" uuid="{F0DA20C7-07B8-C85E-2059-9427526D7CC1}"><label/><display>Alex Arwine</display><dirn uuid="{7CEFB9B0-3978-4ECE-95D6-E9ECE7DE05DC}"/><ringSetting>Use System Default</ringSetting><consecutiveRingSetting>Use System Default</consecutiveRingSetting><ringSettingIdlePickupAlert>Use System Default</ringSettingIdlePickupAlert><ringSettingActivePickupAlert>Use System Default</ringSettingActivePickupAlert><displayASCII>Alex Arwine</displayASCII><e164Mask>3603305XXX</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><recordingProfileName/><monitoringCSSName/><recordingFlagName>Call Recording Disabled</recordingFlagName><audibleMWI>Default</audibleMWI><speedDial/><partitionUsage>General</partitionUsage><associatedEndusers/></line></lines><numberOfButtons>2</numberOfButtons><phoneTemplate uuid="{5D19AD33-5212-464E-8EAE-9FDBC07032BB}"/><speeddials/><busyLampFields/><primaryPhoneName/><blfDirectedCallParks/><addOnModules/><userLocale>English United States</userLocale><networkLocale>United States</networkLocale><services/><softkeyTemplateName>Standard User</softkeyTemplateName><loginUserId/><currentConfig><userHoldMOHAudioSourceId>0</userHoldMOHAudioSourceId><phoneTemplate uuid="{5D19AD33-5212-464E-8EAE-9FDBC07032BB}"/><mlppDomainId>-1</mlppDomainId><mlppIndicationStatus>Default</mlppIndicationStatus><preemption>Default</preemption><softkeyTemplateName>Standard User</softkeyTemplateName><ignorePresentationIndicators>false</ignorePresentationIndicators><callInfoPrivacyStatus>Default</callInfoPrivacyStatus><dndStatus>false</dndStatus></currentConfig><builtInBridgeStatus>Default</builtInBridgeStatus><callInfoPrivacyStatus>Default</callInfoPrivacyStatus><hlogStatus>On</hlogStatus><ownerUserId/><ignorePresentationIndicators>false</ignorePresentationIndicators><packetCaptureMode>None</packetCaptureMode><packetCaptureDuration>60</packetCaptureDuration><allowCtiControlFlag>true</allowCtiControlFlag><presenceGroupName>Standard Presence group</presenceGroupName><unattendedPort>false</unattendedPort><certificateOperation>No Pending Operation</certificateOperation><authenticationString/><certificateStatus>None</certificateStatus><upgradeFinishTime/><deviceMobilityMode>Default</deviceMobilityMode><remoteDevice>false</remoteDevice><dndOption>Ringer Off</dndOption><dndStatus>false</dndStatus><isDualMode>false</isDualMode><phoneSuite>Default</phoneSuite></device></return></axl:getPhoneResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>"

    Subject: Re: Associating a line with a phone?
    Replied by: Stephan Steiner on 14-10-2008 01:39:36 PM
    Alex, did you check out the AXL schema (you can find it here: http://developer.cisco.com/web/axl/docs)? It lists the structure of each request and response.

    In case of getPhone, the lines element contains 0-1 line elements.. each line element has an uuid and corresponds to the devicenumplanmap table in the database (the uuid = pkid in the database). Then there's one dn element in each line, which is short for directorynumber.. you only get the uuid of that element. If you do a getLine with that uuid as parameter, you'll get the actual line (and the pattern element contains your number). Database wise.. the directorynumber maps to the numplan table, and dnorpattern is the actual number.

    So in your case, you'd do a getPhone for the phone, then a getLine for all the lines you want to associate (you either need the uuid which you can e.g. get with an executesqlquery (select pkid from numplan where dnorpattern='my_phone_number_here') or by specifying both the pattern (number) and partition for the getLine (since you can have the same number in multiple partitions the partition is a mandatory element unless you specify the uuid). Then, you add the line element(s) to the phone, fill out the required values for the line element, and put the dn uuid in there to make the link to the actual number.

    Subject: Re: Associating a line with a phone?
    Replied by: Alex Arwine on 14-10-2008 11:41:28 PM
    Awesome, DN/uuid thing makes sense now.

    I dont' suppose there is a shortcut to add a line exactly like another line (same DN etc) with just a separate partition?

    Right now I'm having to grab all the info from one line, store them in a respective array then pass it to addline.

    Ideas?

    Thanks so much,
    -Alex

    Subject: Re: Associating a line with a phone?
    Replied by: Stephan Steiner on 16-10-2008 09:34:33 AM
    You mean like copyLine(uuid)? I'm afraid there's no such command.
    It may however be possible to do something directly via database, however you need a new pkid so a simple insert into devicenumplanmap select * from devicenumplanmap where pkid = ... won't do.

    Subject: RE: Re: Associating a line with a phone?
    Replied by: Jeffrey Sailers on 10-07-2009 05:24:42 PM
    I know this is an old post, but for future onlookers, if you want to copy the settings of en existing line to make a new line, you can do a getLine call, load the xml into an XMLDocument and manipulate the individual XMLnodes as you desire (in this case the routePartitionName element or the routePartition element including the uuid attribute (which would be the PKID of the routePartition).  Some might find this more difficult than storing the values in an array or class properties, but for those used to working with XML, it could prove useful.