@@ -119,11 +119,14 @@ es_status es_osip_init(OUT es_osip_t **_ctx, struct event_base *base)
119
119
/* list of pending event */
120
120
if (osip_list_init (& ctx -> pendingEv ) != OSIP_SUCCESS ) {
121
121
ESIP_TRACE (ESIP_LOG_ERROR , "List for pending event initialization failed" );
122
+ free (ctx -> osip );
123
+ free (ctx );
122
124
return ES_ERROR_OUTOFRESOURCES ;
123
125
}
124
126
125
127
/* Set internal OSip Callback */
126
128
if ((ret = _es_osip_set_internal_callbacks (ctx )) != ES_OK ) {
129
+ free (ctx -> osip );
127
130
free (ctx );
128
131
return ret ;
129
132
}
@@ -159,9 +162,6 @@ es_status es_osip_parse_msg(IN es_osip_t *_ctx, const char *buf, unsigned int si
159
162
return ES_ERROR_NETWORK_PROBLEM ;
160
163
}
161
164
162
- /* TODO: Chekc message type and send it to responsable module */
163
-
164
- /* Assume it's INVITE Look for existant OSip Transaction */
165
165
if (osip_find_transaction_and_add_event (ctx -> osip , evt ) != OSIP_SUCCESS ) {
166
166
ESIP_TRACE (ESIP_LOG_INFO , "New transaction" );
167
167
osip_transaction_t * tr = NULL ;
@@ -382,10 +382,10 @@ static es_status _es_tools_build_response(
382
382
}
383
383
384
384
/* Set From header */
385
- osip_from_clone (req -> from , & msg -> from );
385
+ osip_from_clone (req -> to , & msg -> from );
386
386
387
387
/* Set To header */
388
- osip_to_clone (req -> to , & msg -> to );
388
+ osip_to_clone (req -> from , & msg -> to );
389
389
random_tag = osip_build_random_number ();
390
390
snprintf (str_random , sizeof (str_random ), "%d" , random_tag );
391
391
osip_to_set_tag (msg -> to , osip_strdup (str_random ));
@@ -445,6 +445,8 @@ static int _es_internal_send_msg_cb(
445
445
446
446
es_transport_send (ctx -> transportCtx , addr , port , buf , buf_len );
447
447
448
+ free (buf );
449
+
448
450
return OSIP_SUCCESS ;
449
451
}
450
452
@@ -496,6 +498,7 @@ static void _es_internal_message_cb(int type, osip_transaction_t *tr, osip_messa
496
498
break ;
497
499
case OSIP_NIST_REGISTER_RECEIVED :
498
500
{
501
+ /* TODO: Send it to REGISTRAR module */
499
502
ESIP_TRACE (ESIP_LOG_INFO ,"OSIP_NIST_REGISTER_RECEIVED" );
500
503
501
504
osip_message_set_status_code (response , SIP_OK );
0 commit comments