/**
 *
 */
package com.uc.demo;

import com.huawei.esdk.uc.professional.local.bean.south.SipAccount;
import com.huawei.esdk.uc.professional.local.bean.south.SipAuth;
import com.huawei.esdk.uc.professional.local.bean.south.SipRequest;
import com.huawei.esdk.uc.professional.local.factory.ServiceFactoryEx;
import com.huawei.esdk.uc.professional.local.service.UserProfileServiceEx;

/**
 * 
 * @team BBDTEK IT Team
 * @author renmb
 * @version 1.0
 * @time  2016年10月27日
 */
public class SipDemoMain {

    /**
     * 
     * @author renmb
     * @time  2016年10月27日
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        int sipNum = Integer.parseInt(args[0]);
//        if(args.length == 1){
//            sipNum = Integer.parseInt(args[0]);
//        }
//        int maxSipNum = 8019;
        String gwIp = "10.73.253.252";
        String userId = "123";
        
        UserProfileServiceEx userProfileServiceEx = ServiceFactoryEx.getService(UserProfileServiceEx.class);

        SipRequest numberInfo = new SipRequest();
        numberInfo.setUserId(userId);
        numberInfo.setSip(new SipAccount());
        numberInfo.getSip().setGwIp(gwIp);
        numberInfo.getSip().setSubPbx("1");
        numberInfo.getSip().setLocalGwIp("");
        numberInfo.getSip().setJoint("0");
        
        numberInfo.getSip().setSipUe(String.valueOf(sipNum));
        numberInfo.getSip().setUeType("2");
        numberInfo.getSip().setNumber(String.valueOf(sipNum));
//        numberInfo.getSip().setLongNum("6000" + String.valueOf(sipNum));
        
        
        numberInfo.getSip().setRightLevel("0");
        numberInfo.getSip().setAddPrefix("0");
        numberInfo.getSip().setbOutgoingRights("1111000000000000");
//        numberInfo.getSip().setcOutgoingRights("1111111111111111");
        numberInfo.getSip().setSipAuth(new SipAuth());
        numberInfo.getSip().getSipAuth().setType("1");
        numberInfo.getSip().getSipAuth().setPassword(sipNum + "@foc2016");
        //调用userProfileServiceEx服务中的addNumber方法，返回错误码
        Integer res = userProfileServiceEx.addNumber(numberInfo);
        
        System.out.println("返回结果： "+res);
    }

}
