Child pages
  • Adding Users with PHP
Skip to end of metadata
Go to start of metadata

This uses the sipXconfig SOAP API.

Creating a sipXecs user with PHP
<?php>

addSipXecsUser($ext,$fname,$lname,$pin,$alias);

function addSipXecsUser($ext,$fname,$lname,$pin,$alias)
{
	$client = new SoapClient("https://sipx:8443/sipxconfig/services/UserService?wsdl", array('login' => "superadmin", 'password' => "your_sipxecs_superadmin_pw_here", 'authentication' => SOAP_AUTHENTICATION_DIGEST));
	
	try {
		//this is the data from the <complexType name="User"> field -- it's all optional so make sure the single quotes match the wsdl then poulate the doubles with whatever you want
		$userdata = array('userName'=>$ext, 'lastName' => $lname, 'firstName' => $fname, 'sipPassword'=>randomKey(), 'emailAdress'=>$alias."@yourdomain.com", 'aliases'=>$alias);
		
		//probably won't change this line - the userdata is from the array above, the pin is generated by the end user as their voicemail key
		$user = array('user'=>$userdata, 'pin'=>$pin);
		
		//make the soap call
		$client->__soapCall("addUser",array($user));
	}
	catch (SoapFault $soapFault) 
	{
		$error=true;
	}
	
	//post soap functionality
	if($error==true)
	{
		return "error";
	}
	else
	{
		addForwarding($ext,$ext,$pin);
		return "success";
	}

}
</php>
  • No labels