MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / xmpp_send_sip_msg

Function xmpp_send_sip_msg

modules/xmpp/xmpp.c:278–312  ·  view source on GitHub ↗

Relay a MESSAGE to a SIP client */

Source from the content-addressed store, hash-verified

276
277/* Relay a MESSAGE to a SIP client */
278int xmpp_send_sip_msg(char *from, char *to, char *msg)
279{
280 str msg_type = { "MESSAGE", 7 };
281 str hdr, fromstr, tostr, msgstr;
282 char buf[512];
283 char buf_from[256];
284
285 ENC_SIP_URI(fromstr, buf_from, from);
286
287 hdr.s = buf;
288 hdr.len = snprintf(buf, sizeof(buf),
289 "Content-type: text/plain" CRLF "Contact: %s" CRLF, from);
290
291 tostr.s = uri_xmpp2sip(to, &tostr.len);
292 if(tostr.s == NULL) {
293 LM_ERR("Failed to translate xmpp uri to sip uri\n");
294 return -1;
295 }
296
297 msgstr.s = msg;
298 msgstr.len = strlen(msg);
299
300 return run_tm_api(&tmb, t_request,
301 &msg_type, /* Type of the message */
302 0, /* Request-URI */
303 &tostr, /* To */
304 &fromstr, /* From */
305 &hdr, /* Optional headers */
306 &msgstr, /* Message body */
307 (outbound_proxy.s)?&outbound_proxy:NULL,/* Outbound proxy*/
308 0, /* Callback function */
309 0,
310 0 /* Callback parameter */
311 );
312}
313
314
315/*********************************************************************************/

Callers 2

stream_node_callbackFunction · 0.85
in_stream_node_callbackFunction · 0.85

Calls 1

uri_xmpp2sipFunction · 0.85

Tested by

no test coverage detected