Pjsip : registration status detail in failure case


#1

Hi all ,

This is my first topic and , please be indulgent . :slight_smile:
I am use pjsip registration callback for handle statut registration.
is there a way to have SIP detail status ( eg : 401 , 404 , etc…) ?

Thx a lot

T


#2

You’ll need to provide more detail. Are you referring to in Asterisk? Using AMI or something?


#3

Hi
i am use this mechanisme

convert an ami_message peer entry into a registrystatus.
@return status
https://wiki.asterisk.org/wiki/display/AST/Configuring+Outbound+Registrations

and i get the same information as this cli command :

pjsip show registrations


#4

The response code is not currently stored or reported with those.


#5

Do you know a different way ?


#6

Not without code modifications to various things.


#7

Ok , thx
if i want modify code , i suppose this is in <res_pjsip_outbound_registration.c> file ?


#8

Yes, however the message which is converted to AMI is a core thing so that exists elsewhere.


#9
--- D:/Tools/patch_pjsip/pjsip_outbound_registration_patch/res_pjsip_outbound_registration.c	mer. févr.  6 09:37:07 2019
+++ D:/Tools/patch_pjsip/pjsip_outbound_registration_patch/mod_res_pjsip_outbound_registration.c	mer. févr.  6 09:59:38 2019
@@ -362,0 +363,2 @@ struct sip_outbound_registration_client_state {
+	/*! \brief The SIP response code */
+	int response_code;
@@ -889 +891 @@ static int handle_registration_response(void *data
-
+	response->client_state->response_code = response->code;
@@ -1824,2 +1826,2 @@ static int ami_outbound_registration_task(void *ob
-		ast_str_append(&buf, 0, "Status: %s\r\n",
-			sip_outbound_registration_status_str(state->client_state->status));
+		ast_str_append(&buf, 0, "Status: %s#%d\r\n",
+			sip_outbound_registration_status_str(state->client_state->status),state->client_state->response_code);

i have making this patch.
I don’t think that is acceptable for the community. :sleepy:

Thx a lot

Thierry