Technical Helpweb

Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) - more articles

PowerMedia XMS 2.4 RESTful 3gpp recording demo

Introduction:

The Dialogic® PowerMedia™ XMS Release 2.4 software allows the use of the 3GP container format for recording and playback of media. This article  provides a demonstration of how a user can exercise the new (for Release 2.4) functionality using the HTTP RESTful API in conjunction with the XMSTool RESTful utility. XMSTool is used for developing, debugging, and supporting applications for the PowerMedia XMS using the HTTP RESTful API.

 

Details:

3GP is an ISO-based multimedia file format and subset of the MP4 file container. It encapsulates audio and video in the same file. The PowerMedia XMS Release 2.4 software supports play and record directly to/from a .3gp file, support for audio only, video only and audio+video files, H.264 (up to HD720p @ 2Mbps) and AMR-NB and AMR-WB.

Note:  As of May 2015, H.263 video is supported for playback ONLY and MPEG4 video is not supported.  The AMR-NB and AMR-WB are the only audio codecs supported.

This article provides a script to be used with XMSTool.   The script will wait for an inbound SIP call and answer it.   It will then start a record operation using AMR and H.264 codecs for audio / video respectively with a 10 second timeout. After the timeout, it will play back the recorded audio / video and hangup.

The XML script file that can be downloaded is record3gpp.zip. It contains a single file "record3gpp.xml" which is the script. To install it, copy the file to the XMSTool/testing directory and modify "xmstool.cfg" by adding "record3gpp.xml" as a new line at the bottom. Save and restart XMSTool and "record3gpp" will appear as an option in the drop down list of demos.

Alternatively, it is possible to use XMSTool in advanced mode to achieve the same result. Simply switch to advanced mode, make an inbound SIP call and answer it by clicking the call-id in the list, selecting "AnswerCall" from the "features" drop down list, then click "Initialize Input" and then "Update" to send the message to the PowerMedia XMS server.

From there, paste the following into the "Input:" field and click "Update" to record a .3gp file:

<call>
   <call_action>
      <record terminate_digits="#" max_time="10s"
         recording_audio_uri="file://recorded/test.3gp" recording_audio_type="audio/3gpp"
         recording_video_uri="file://recorded/test.3gp" recording_video_type="video/3gpp">
         <recording_audio_mime_params codec="AMR" mode="7" rate="8000" />
         <recording_video_mime_params codec="h264" profile="66" level="3.0" framerate="30" maxbitrate="768000" height="480" width="640" />
      </record>
   </call_action>
</call>


This should result in a response looking like this in the "Output:" field:

200
OK
<web_service version="1.0">
<call_response identifier="96e7753f-0571-4d75-a731-725392ec48a1" appid="app" href="/default/calls/96e7753f-0571-4d75-a731-725392ec48a1"
 connected="yes" signaling="yes" cpa="no" call_type="inbound"
 media="audiovideo"
 dtmf_mode="rfc2833"
 destination_uri="sip:01628581819@192.168.186.104"
 source_uri="sip:martyn@192.168.185.130"
 async_dtmf="yes" async_tone="yes" cleardigits="no" encryption="none" ice="no" info_ack_mode="automatic" hangup_ack_mode="automatic" early_media="no" audio="sendrecv" video="sendrecv">
<call_action>
<record transaction_id="4da0ed8e-34b7-4e5d-afd6-f46c210d6a7d"
terminate_digits="#"max_time="10s"
max_silence="infinite"
noinput_timeout="infinite"
recording_audio_uri="file://recorded/test.3gp"
recording_audio_type="audio/3gpp"
recording_video_type="video/3gpp"
recording_video_uri="file://recorded/test.3gp">
<recording_audio_mime_params codec="AMR" rate="8000"/>
<recording_video_mime_params codec="h264" profile="66" level="3.0" framerate="30" maxbitrate="768000" height="480" width="640"/>
</record>
</call_action>
</call_response>
</web_service>


... and on completion of the record an event:

(Event #15) <web_service version="1.0">
<event type="end_record" resource_id="96e7753f-0571-4d75-a731-725392ec48a1" resource_type="call">
<event_data name="audio_file_size" value="0" />
<event_data name="duration" value="10020" />
<event_data name="id" value="96e7753f-0571-4d75-a731-725392ec48a1" />
<event_data name="media_id" value="4da0ed8e-34b7-4e5d-afd6-f46c210d6a7d" />
<event_data name="reason" value="max-time" />
<event_data name="transaction_id" value="4da0ed8e-34b7-4e5d-afd6-f46c210d6a7d" />
<event_data name="type" value="END_RECORD" />
<event_data name="video_file_size" value="0" />
</event>
</web_service>


Paste the following into the "Input:" field and click "Update" to play the file that was recorded above:

<call>
   <call_action>
      <play offset="0s" repeat="0" delay="0s" terminate_digits="#" max_time="infinite" skip_interval="10s">
         <play_source location="file://recorded/test.3gp"/>
      </play>
   </call_action>
</call>


Again, this should result in a success response:

200
OK
<web_service version="1.0">
<call_response identifier="96e7753f-0571-4d75-a731-725392ec48a1" appid="app" href="/default/calls/96e7753f-0571-4d75-a731-725392ec48a1"connected="yes" signaling="yes" cpa="no" call_type="inbound"
 media="audiovideo"
 dtmf_mode="rfc2833"
 destination_uri="sip:01628581819@192.168.186.104"
 source_uri="sip:martyn@192.168.185.130"
 async_dtmf="yes" async_tone="yes" cleardigits="no" encryption="none" ice="no" info_ack_mode="automatic" hangup_ack_mode="automatic" early_media="no" audio="sendrecv" video="sendrecv">
<call_action>
<play transaction_id="1ca28478-741f-45a7-99fe-114b3164888c"
max_time="infinite"
fetch_timeout="300s"
offset="0s"
delay="0s"
repeat="0"
skip_interval="10s"
terminate_digits="#">
<play_source location="file://recorded/test.3gp"/>
</play></call_action>
</call_response>
</web_service>


... and a completion event:

(Event #16) <web_service version="1.0">
<event type="end_play" resource_id="96e7753f-0571-4d75-a731-725392ec48a1" resource_type="call">
<event_data name="duration" value="9960" />
<event_data name="id" value="96e7753f-0571-4d75-a731-725392ec48a1" />
<event_data name="media_id" value="1ca28478-741f-45a7-99fe-114b3164888c" />
<event_data name="reason" value="end" />
<event_data name="status" value="0 No Error" />
<event_data name="transaction_id" value="1ca28478-741f-45a7-99fe-114b3164888c" />
<event_data name="type" value="END_PLAY" />
</event>
</web_service>


 

Product List:

Dialogic® PowerMedia™ XMS Release 2.4




Feedback

Please rate the usefulness of this page:  
0 - not useful at all
1 - potentially useful
2 - quite useful
3 - very useful
4 - exactly the information I needed     

Please enter a comment about this page:

First published: 22-May-2015
Open access: Product rule: open; Page rule: Auto