<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span>Hi all,</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span>I have small issue when i am trying to handle extra register with another server. </span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color:
rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span>Let me explain my idea.</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span>First : when xlite(192.168.1.158) send REGISTER message to FS, it will store message (or something like that to recognize thread from xlite, but I dont know exactly which value will be stored in msg1).</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0);
background-color: transparent; font-style: normal;"><span>Then, I will send one REGISTER message to another server (like asterisk (192.168.1.174)), and when asterisk server return(100 first, then 401 include realm, nonce, auth_params), I need to store message thread like the first one (to reused like msg2), then, i will use nua_response to transfer 401 message to xlite(with realm, nonce). </span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Then I can do the same when i get REGISTER message (with password in md5) from xlite and forwarding to asterisk server for authen.</div><div style="font-family: 'times new roman', 'new york', times, serif;
font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">So, I have try to store message in to msg_t variable but i get error 500 - Responding to a Non-Existing Request when try to send back 401 with realm, nonce to xlite.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I have used this function to store msg to one variable:</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent;
font-style: normal;"><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">(in function sofia.c/sofia_event_callback )</div><div style="background-color: transparent;"><div style="background-color: transparent;">if(event == nua_i_register){</div><div style="background-color: transparent;"> msg1 = de->data->e_msg ;</div><div style="background-color: transparent;"> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "tnt: done store msg1 into catche \n");</div><div style="background-color: transparent;"> }</div><div style="background-color: transparent;"> if (event == nua_r_register){</div><div style="background-color: transparent;">
msg2 = de->data->e_msg ;</div><div style="background-color: transparent;"> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "tnt: done store msg2 into catche \n");</div><div style="background-color: transparent;"> }</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;">and send back 401 like:</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;"><br></div><div><div>case nua_r_register:</div><div> switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "nua_r_register : process
handler ===========>>>>> \n ");</div><div> if (status == 401 || status == 407){</div><div> sip_www_authenticate_t const* www_auth = sip->sip_www_authenticate;</div><div> char const* scheme = www_auth->au_scheme;</div><div> const char* realm = msg_params_find( www_auth->au_params, "realm=" );</div><div> const char* nonce = msg_params_find( www_auth->au_params, "nonce=" );</div><div> char *auth_str;</div><div>
auth_str = switch_mprintf("%s realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", scheme,realm, nonce," stale=true,");</div><div> nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS_MSG(msg2), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());</div><div><br></div><div> break;</div><div> }</div><div> break;</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new
roman', 'new york', times, serif; font-size: 16px; font-style: normal;">I am new in this and need your help, please suggest or reference some link that i can get it work,</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal;">thank all in advance.</div></div></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> </div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">ThanhTruong</div></div></body></html>