freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

Modified MSRP code to generate events

Open sharmilas2704 opened this issue 3 years ago • 0 comments

Purpose This fixes the handling of events for msrp messages.

Overview To generate events for msrp messages ,which contains the payload, sub-class and unique-id.

Enhancements 1.Added a new function for generating events with payload, sub-class and unique-id. 2.To make the code backward compatibility added a new setting fire-event to enable or disable the events.

Problems faced 1.Not able to get unique-id inside generate_event function 2.Messages were not fully received / fired example: MSRP 1231763382 SEND\r\n To-Path: msrp://15.200.184.209:2857/6afb4b4f-fd23-49dc-8eca-75e7dbf96ffa;tcp\r\n From-Path: msrp://98.78.82.180:6389/34145099-1011644133-34145100;tcp\r\n Message-ID: T0456528aC1231763382\r\n Byte-Range: 1-2/2\r\n Content-Type: text/plain\r\n \r\n ]

Changes done 1.Created a new function for generating events in switch_msrp.c file in which added the payload, unique-id and MSRP-Data. 2.Moved the msrp_find_uuid function before the generate_event function to get a unique-id in the event. 3.Added a while-loop condition inside the msrp_worker function to get the whole message by checking whether the received MSRP has delimiter(-----TOKEN$) or not and appending the messages into buffer by following fragments. sample output: 1st fragment

RECV [22] bytes [ MSRP 1231763382 SEND\r\n ] 2nd fragment

RECV [227] bytes [ To-Path: msrp://15.200.184.209:2855/6afb4b4f-fd23-49dc-8eca-75e7dbf96ffa;tcp\r\n From-Path: msrp://98.78.82.180:6389/34145099-1011644133-34145100;tcp\r\n Message-ID: T0456528aC1231763382\r\n Byte-Range: 1-9/9\r\n Content-Type: text/plain\r\n ] 3rd fragment

RECV [2] bytes [ \r\n ]

MSRP 1231763382 SEND\r\n To-Path: msrp://15.200.184.209:2855/6afb4b4f-fd23-49dc-8eca-75e7dbf96ffa;tcp\r\n From-Path: msrp://98.78.82.180:6389/34145099-1011644133-34145100;tcp\r\n Message-ID: T0456528aC1231763382\r\n Byte-Range: 1-9/9\r\n Content-Type: text/plain\r\n \r\n Hello msrp\r\n ] 4.Added a new setting in configuration file to enable or disable events.

sharmilas2704 avatar Jul 29 '22 18:07 sharmilas2704