Request command

The Request command allows you to call a specified phone number and perform operations with an OzML script. In the OzML script, you can specify the sequence of operations that will be performed depending on the call states.

Request parameters

Parameter name Example value Description Mandatory
CallerDisplayName John Smith Displayed name of the caller which will be displayed on the called side. no
CallerPhoneNumber 105 Phone number of the caller which will be displayed on the called side. no
DialedAddress 102@localhost Phone number of the callee. yes
ExtensionAddress 105@localhost Address of the extension from where the call will be initiated. It must be a configured API extension. no
RequestOzML The OzML script containing the Request command. It should only be filled in case of HTTP request. no
RingTime 120 The ring time of the call in seconds. If expires, the call will be closed. no
Username admin The username of the account. The username and password parameters are used to authenticate the user. yes
Password abc123 Specifies the password. The username and password parameters are used to authenticate the user. yes

Response parameters

Parameter name Example value Description Mandatory
Code 200 Returns the status code of the response. yes
Message Command successfully executed Returns th description of the response code. yes
NotificationName CallConnected Name of the notification request type. no

OzML example

This OzML example demonstrates that how you can use the Request command to start a call, and perform actions during the different stations. In case of a call state a SendMessageToConn or a Speak command will be executed.

<Request DialedAddress='101' ExtensionAddress='106' CallerPhoneNumber='106' CallerDisplayName='John Smith' RingTime='120'>
  <OnSetup>
    <SendMsg ToConnection='admin@localhost'>The call has been started. (The INVITE message has been sent</SendMsg>
  </OnSetup>
  <OnError>
    <SendMsg ToConnection='admin@localhost'>An error occured during the call. (eg. the remote party was not found, or no supported codecs found)</SendMsg>
  </OnError>
  <OnRinging>
    <SendMsg ToConnection='admin@localhost'>Ringing.</SendMsg>
  </OnRinging>
  <OnQueued>
    <SendMsg ToConnection='admin@localhost'>The called party is temporarily unavailable, but the server has decided to queue the call rather than reject it.</SendMsg>
  </OnQueued>
  <OnAnswered>
    <SendMsg ToConnection='admin@localhost'>The call has been answered. This state occurs only once per call.</SendMsg>
  </OnAnswered>
  <OnRemoteHeld>
    <SendMsg ToConnection='admin@localhost'>The remote call party put the call on hold.</SendMsg>
  </OnRemoteHeld>
  <InCall>
    <Speak>Hello! You can use Speak commands in this state.</Speak>
    <SendMsg ToConnection='admin@localhost'>There is active communication between the two parties. The call can step into the 'InCall' state multiple times.</SendMsg>
  </InCall>
  <OnCompleted>
    <SendMsg ToConnection='admin@localhost'>The call has been hung up by the caller or callee.</SendMsg>
  </OnCompleted>
  <OnRejected>
    <SendMsg ToConnection='admin@localhost'>The call has been rejected by the callee</SendMsg>
  </OnRejected>
  <OnCancelled>
    <SendMsg ToConnection='admin@localhost'>The call has been cancelled by the caller.</SendMsg>
  </OnCancelled>
  <OnBusy>
    <SendMsg ToConnection='admin@localhost'>The call has been rejected by the callee.</SendMsg>
  </OnBusy>
</Request>

Example request and response

URL request

http://127.0.0.1:9509/api?command=Request&DialedAddress=101&CallerPhoneNumber=106&CallerDisplayName=John+Smith&RingTime=120&RequestOzML=The call is in 'InCall' state.&Username=HTTP_User_1&Password=qwe123

Response

<?xml version="1.0"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Code>200</Code>
  <Message>Command successfully executed</Message>
</Response>

More information