How to add a line to a Phone in C#

Version 1
    This document was generated from CDN thread

    Created by: julien CHODLEWSKI on 29-07-2009 01:46:05 PM
    Hello,
     
    I already read thisthread http://developer.cisco.com/web/axl/forums/-/message_boards/message/1482205  and I think I understand it.
     
    So I build my XNPDirectoryNumber, get the uuid. And put it in a XLine.


    XNPDirectoryNumber dn1 = new XNPDirectoryNumber();
    //wrote some information into it
    dn1.pattern = "1021";

    dn1.alertingName = "Test 1021";
    dn1.description =  "Description 1021";


    AddLineReq lineReq1 = new AddLineReq();


    lineReq1.newLine = dn1;

    //add the line and get the uuid in lineResponse.@return

    StandardResponse lineResponse = myAxl.addLine(dirnReq);


    XLine lineAppear = new XLine();
    lineAppear.Item.uuid = lineResponse.@return;

    lineAppear.label = "Test Label";
    lineAppear.display = "Test Disp";

     
    But I don't understand how to add this Xline into my phone. I think that is in newphone.lines.Items, but I tried some ways to do that and no one works fine.
     
    Can someone help me ?
     
    Thanks

    Subject: RE: How to add a line to a Phone in C#
    Replied by: Sumesh Menon on 30-07-2009 07:14:57 AM
    Hi Julien,
     
    Please try following code to add line.
     

    XIPPhoneLines _lines = new XIPPhoneLines();

    XNPDirectoryNumber newnum = new XNPDirectoryNumber();

    XLineCallInfoDisplay callinfor = new XLineCallInfoDisplay();<font size="2">

    XLine _line = new XLine();

    callinfor.callerName = true;
    callinfor.callerNumber = true;
    callinfor.dialedNumber = true;
    callinfor.redirectedNumber = true;
    _line.callInfoDisplay = callinfor;
     _line.label = "Line1";
    _line.display = "Line1";
    _line.index = "1";
    newnum.pattern = "34444";
    newnum.usage = "Device";
    newnum.aarDestinationMask = "2XXXX";
    newnum.alertingName = "Alerting Name";
    _line.Item = newnum;
    _line.displayASCII = "displayASCII";
    _line.e164Mask = "2XXXX";
    object[] itemsField1 = new object[4];
    itemsField1.SetValue(_line, 0);
    _lines.Items=itemsField1;
    ..
    Ur addphone code
    .
    .
    .
     

    phone.lines = _lines;
     
    ...
     
     
    This should work :-)
     
    Cheers
     

    Subject: RE: How to add a line to a Phone in C#
    Replied by: julien CHODLEWSKI on 30-07-2009 08:34:40 AM
    Great, it works fine !
     
    I just had to insert the XNPDirectoryNumber before the phone, and give the uuid to _line.Item and it works.
     
    Thank you