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

Function push_new_processing_context

modules/dialog/dlg_req_within.h:53–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51typedef void (dlg_release_func)(void *param);
52
53static inline int push_new_processing_context( struct dlg_cell *dlg,
54 context_p *old_ctx, context_p **new_ctx,
55 struct sip_msg **fake_msg)
56{
57 static context_p my_ctx = NULL;
58
59 *old_ctx = current_processing_ctx;
60 if (my_ctx==NULL) {
61 my_ctx = context_alloc(CONTEXT_GLOBAL);
62 if (my_ctx==NULL) {
63 LM_ERR("failed to alloc new ctx in pkg\n");
64 return -1;
65 }
66 }
67 if (current_processing_ctx==my_ctx) {
68 LM_CRIT("BUG - nested setting of my_ctx\n");
69 return -1;
70 }
71
72 if (fake_msg) {
73 *fake_msg = get_dummy_sip_msg();
74 if (*fake_msg == NULL) {
75 LM_ERR("cannot create new dummy sip request\n");
76 return -1;
77 }
78 }
79
80 /* reset the new to-be-used CTX */
81 memset( my_ctx, 0, context_size(CONTEXT_GLOBAL) );
82
83 /* set the new CTX as current one */
84 set_global_context(my_ctx);
85
86 /* store the value from the newly created context */
87 *new_ctx = &my_ctx;
88
89 /* set this dialog in the ctx */
90 ctx_dialog_set(dlg);
91 /* ref it, and it will be unreffed in context destroy */
92 ref_dlg(dlg, 1);
93
94 return 0;
95}
96
97#define CONTACT_STR_START "Contact: <"
98#define CONTACT_STR_START_LEN (sizeof(CONTACT_STR_START)-1)

Callers 6

dual_bye_eventFunction · 0.85
send_leg_byeFunction · 0.85
send_leg_msgFunction · 0.85
run_dlg_script_routeFunction · 0.85
dlg_ontimeoutFunction · 0.85

Calls 2

context_allocFunction · 0.85
get_dummy_sip_msgFunction · 0.85

Tested by

no test coverage detected