Add accessor to public contact used by belle_sip_refresher

parent 562bef37
...@@ -101,6 +101,11 @@ BELLESIP_EXPORT const belle_sip_list_t* belle_sip_refresher_get_auth_events(cons ...@@ -101,6 +101,11 @@ BELLESIP_EXPORT const belle_sip_list_t* belle_sip_refresher_get_auth_events(cons
**/ **/
BELLESIP_EXPORT void belle_sip_refresher_enable_manual_mode(belle_sip_refresher_t *refresher, int enabled); BELLESIP_EXPORT void belle_sip_refresher_enable_manual_mode(belle_sip_refresher_t *refresher, int enabled);
/**
* Retrieve last know public ip:port contact used.
**/
BELLESIP_EXPORT char* belle_sip_refresher_get_public_uri(belle_sip_refresher_t* refresher);
BELLE_SIP_END_DECLS BELLE_SIP_END_DECLS
#endif /* REFRESHER_HELPER_H_ */ #endif /* REFRESHER_HELPER_H_ */
...@@ -226,6 +226,13 @@ static size_t belle_sip_channel_input_stream_get_buff_length(belle_sip_channel_i ...@@ -226,6 +226,13 @@ static size_t belle_sip_channel_input_stream_get_buff_length(belle_sip_channel_i
return sizeof(input_stream->buff) - (input_stream->write_ptr-input_stream->buff); return sizeof(input_stream->buff) - (input_stream->write_ptr-input_stream->buff);
} }
char *belle_sip_channel_get_public_ip_port(belle_sip_channel_t *obj){
if (obj->public_ip){
return belle_sip_strdup_printf("%s:%d", obj->public_ip, obj->public_port);
}
return NULL;
}
void belle_sip_channel_set_public_ip_port(belle_sip_channel_t *obj, const char *public_ip, int port){ void belle_sip_channel_set_public_ip_port(belle_sip_channel_t *obj, const char *public_ip, int port){
if (obj->public_ip){ if (obj->public_ip){
int ip_changed=0; int ip_changed=0;
......
...@@ -167,6 +167,7 @@ int belle_sip_channel_is_reliable(const belle_sip_channel_t *obj); ...@@ -167,6 +167,7 @@ int belle_sip_channel_is_reliable(const belle_sip_channel_t *obj);
const char * belle_sip_channel_get_transport_name(const belle_sip_channel_t *obj); const char * belle_sip_channel_get_transport_name(const belle_sip_channel_t *obj);
const char * belle_sip_channel_get_transport_name_lower_case(const belle_sip_channel_t *obj); const char * belle_sip_channel_get_transport_name_lower_case(const belle_sip_channel_t *obj);
char *belle_sip_channel_get_public_ip_port(belle_sip_channel_t *obj);
const struct addrinfo * belle_sip_channel_get_peer(belle_sip_channel_t *obj); const struct addrinfo * belle_sip_channel_get_peer(belle_sip_channel_t *obj);
......
...@@ -686,3 +686,6 @@ void belle_sip_refresher_enable_manual_mode(belle_sip_refresher_t *refresher, in ...@@ -686,3 +686,6 @@ void belle_sip_refresher_enable_manual_mode(belle_sip_refresher_t *refresher, in
refresher->manual=enabled; refresher->manual=enabled;
} }
char *belle_sip_refresher_get_public_uri(belle_sip_refresher_t* refresher) {
return belle_sip_channel_get_public_ip_port(refresher->transaction->base.channel);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment