@ -121,6 +121,8 @@ static void *contact_alloc(const char *name)
}
}
ast_string_field_init_extended ( contact , reg_server ) ;
ast_string_field_init_extended ( contact , reg_server ) ;
ast_string_field_init_extended ( contact , via_addr ) ;
ast_string_field_init_extended ( contact , call_id ) ;
/* Dynamic contacts are delimited with ";@" and static ones with "@@" */
/* Dynamic contacts are delimited with ";@" and static ones with "@@" */
if ( ( aor_separator = strstr ( id , " ;@ " ) ) | | ( aor_separator = strstr ( id , " @@ " ) ) ) {
if ( ( aor_separator = strstr ( id , " ;@ " ) ) | | ( aor_separator = strstr ( id , " @@ " ) ) ) {
@ -303,6 +305,7 @@ struct ast_sip_contact *ast_sip_location_retrieve_contact(const char *contact_na
int ast_sip_location_add_contact_nolock ( struct ast_sip_aor * aor , const char * uri ,
int ast_sip_location_add_contact_nolock ( struct ast_sip_aor * aor , const char * uri ,
struct timeval expiration_time , const char * path_info , const char * user_agent ,
struct timeval expiration_time , const char * path_info , const char * user_agent ,
const char * via_addr , int via_port , const char * call_id ,
struct ast_sip_endpoint * endpoint )
struct ast_sip_endpoint * endpoint )
{
{
char name [ MAX_OBJECT_FIELD * 2 + 3 ] ;
char name [ MAX_OBJECT_FIELD * 2 + 3 ] ;
@ -337,6 +340,15 @@ int ast_sip_location_add_contact_nolock(struct ast_sip_aor *aor, const char *uri
ast_string_field_set ( contact , reg_server , ast_config_AST_SYSTEM_NAME ) ;
ast_string_field_set ( contact , reg_server , ast_config_AST_SYSTEM_NAME ) ;
}
}
if ( ! ast_strlen_zero ( via_addr ) ) {
ast_string_field_set ( contact , via_addr , via_addr ) ;
}
contact - > via_port = via_port ;
if ( ! ast_strlen_zero ( call_id ) ) {
ast_string_field_set ( contact , call_id , call_id ) ;
}
contact - > endpoint = ao2_bump ( endpoint ) ;
contact - > endpoint = ao2_bump ( endpoint ) ;
return ast_sorcery_create ( ast_sip_get_sorcery ( ) , contact ) ;
return ast_sorcery_create ( ast_sip_get_sorcery ( ) , contact ) ;
@ -344,6 +356,7 @@ int ast_sip_location_add_contact_nolock(struct ast_sip_aor *aor, const char *uri
int ast_sip_location_add_contact ( struct ast_sip_aor * aor , const char * uri ,
int ast_sip_location_add_contact ( struct ast_sip_aor * aor , const char * uri ,
struct timeval expiration_time , const char * path_info , const char * user_agent ,
struct timeval expiration_time , const char * path_info , const char * user_agent ,
const char * via_addr , int via_port , const char * call_id ,
struct ast_sip_endpoint * endpoint )
struct ast_sip_endpoint * endpoint )
{
{
int res ;
int res ;
@ -356,6 +369,7 @@ int ast_sip_location_add_contact(struct ast_sip_aor *aor, const char *uri,
ao2_wrlock ( lock ) ;
ao2_wrlock ( lock ) ;
res = ast_sip_location_add_contact_nolock ( aor , uri , expiration_time , path_info , user_agent ,
res = ast_sip_location_add_contact_nolock ( aor , uri , expiration_time , path_info , user_agent ,
via_addr , via_port , call_id ,
endpoint ) ;
endpoint ) ;
ao2_unlock ( lock ) ;
ao2_unlock ( lock ) ;
ast_named_lock_put ( lock ) ;
ast_named_lock_put ( lock ) ;
@ -1120,6 +1134,9 @@ int ast_sip_initialize_sorcery_location(void)
ast_sorcery_object_field_register ( sorcery , " contact " , " outbound_proxy " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , outbound_proxy ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " outbound_proxy " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , outbound_proxy ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " user_agent " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , user_agent ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " user_agent " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , user_agent ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " reg_server " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , reg_server ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " reg_server " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , reg_server ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " via_addr " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , via_addr ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " via_port " , " 0 " , OPT_UINT_T , 0 , FLDSET ( struct ast_sip_contact , via_port ) ) ;
ast_sorcery_object_field_register ( sorcery , " contact " , " call_id " , " " , OPT_STRINGFIELD_T , 0 , STRFLDSET ( struct ast_sip_contact , call_id ) ) ;
ast_sorcery_object_field_register ( sorcery , " aor " , " type " , " " , OPT_NOOP_T , 0 , 0 ) ;
ast_sorcery_object_field_register ( sorcery , " aor " , " type " , " " , OPT_NOOP_T , 0 , 0 ) ;
ast_sorcery_object_field_register ( sorcery , " aor " , " minimum_expiration " , " 60 " , OPT_UINT_T , 0 , FLDSET ( struct ast_sip_aor , minimum_expiration ) ) ;
ast_sorcery_object_field_register ( sorcery , " aor " , " minimum_expiration " , " 60 " , OPT_UINT_T , 0 , FLDSET ( struct ast_sip_aor , minimum_expiration ) ) ;