cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
970
Views
0
Helpful
3
Replies

How to get data from subscriptionUri?

zeroone555
Level 1
Level 1

Hi, I am newbie from MediaSense, I try to get data from MediaSense api (subscriptionUri), but I can't. Please help me.

Thank you for your comment or suggestion.

Trinnachart.

3 Replies 3

Hi trinnachart,

   Please describe your question in detail. Show your work. What actually you want to do and what you did so far? And What is the actual error you are getting? Thanks

Generally Using Subscription API you subscribe for Mediasense Call Notification. For this you first write Webservice which will be getting requests on particular URL and you will be using this URL in your Subscription API. And in the response of that API you get the status of your subscription.

Hi Bilal Ahmed Yaseen,

I try to use Mediasense API "subscribeToEvents" to subscribe my Mediasense server, see my code below

$data = array(

  "requestParameters" => array(

  "subscriptionType" => "http",

  "subscriptionUri" => "http://APPLICATION_SERVER_IP:81/test/content.php",

  "subscriptionFilters" => ["RECORDING_EVENTS"]

  )

  );

$url = "https://MEDIASENSE_IP:8440/ora/eventService/event/subscribeToEvents";

$header = array(                                                                         

     'Content-Type: application/json',                                                                               

     'Cookie: JSESSIONID=xxxxxxxxxxxxxxxxxxxxxxx'

  );

$json = json_encode($data);

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

curl_setopt($ch, CURLOPT_HEADER, true);

$result = curl_exec($ch);

curl_close ($ch); // close curl handle

var_dump($result); // show output

After execute my code, I got the result like this

{"responseMessage":"Success: Your request was successfully completed.","responseCode":2000,"responseBody":{"subscriptionFilters":["SESSION_STARTED_EVENT","SESSION_UPDATED_EVENT","SESSION_ENDED_EVENT"],"subscriptionId":"HfKrs2JXPdpfMVW13"}}"

Thank you for your help.

Trinnachart

Hi trinnachart,

  

    According to the response you received from mediasense, It is clear that you subscription process for mediasense notification has been completed successfully. Now, you will be getting notification for the following call events:

"SESSION_STARTED_EVENT","SESSION_UPDATED_EVENT","SESSION_ENDED_EVENT".

Now, Mediasense will push notifications to the URI you mentioned while subscribing, that was:

"http://APPLICATION_SERVER_IP:81/test/content.php"

So, when you will make call from a phone against which recording profile will be enabled, you will get notifications from mediasense on the specified URI.

Now, to receive mediasense notifications, you need to make sure two things:

  1. IP Phones which you are using for callings have recording enabled on it. (Your phone should be properly configured for recording)
  2. Your have properly deployed your listener on some server, and is properly listening on the specified URL. (You can use poster to test this by sending test data to this URL with POST request)

Please let me know If you further need any assistance. Thanks