--- old/channels/chan_sip.c 2009-08-13 10:24:40.000000000 -0700 +++ new/channels/chan_sip.c 2009-08-22 13:47:29.000000000 -0700 @@ -8535,6 +8535,32 @@ ast_md5_hash(a2_hash, a2); snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, usednonce, a2_hash); ast_md5_hash(resp_hash, resp); + + + /* To a Magicjack domain */ + if (strstr(uri,"talk4free.com")) + { + char callid[256]; + char newnonce[256]; + char *c; + int i; + ast_copy_string(callid, p->callid, sizeof(callid)); + ast_copy_string(newnonce, p->nonce, sizeof(newnonce)); + + strcat(newnonce, "_"); + c = newnonce + strlen(newnonce); + char hex[2]; + hex[1] = 0; + for (i = 0; i < 8; i++) { + hex[0] = newnonce[i]; + int x = strtol(hex, NULL, 16); + *c++ = callid[x]; + } + *c++ = 0; + + snprintf(resp,sizeof(resp),"%s:%s:%s", a1_hash, newnonce, a2_hash); + ast_md5_hash(resp_hash, resp); + } } good_response = keys[K_RESP].s && @@ -11658,6 +11684,31 @@ snprintf(resp,sizeof(resp),"%s:%s:%s", a1_hash, p->nonce, a2_hash); ast_md5_hash(resp_hash, resp); + /* To a Magicjack domain */ + if (strstr(uri,"talk4free.com")) + { + char callid[256]; + char newnonce[256]; + char *c; + int i; + ast_copy_string(callid, p->callid, sizeof(callid)); + ast_copy_string(newnonce, p->nonce, sizeof(newnonce)); + + strcat(newnonce, "_"); + c = newnonce + strlen(newnonce); + char hex[2]; + hex[1] = 0; + for (i = 0; i < 8; i++) { + hex[0] = newnonce[i]; + int x = strtol(hex, NULL, 16); + *c++ = callid[x]; + } + *c++ = 0; + + snprintf(resp,sizeof(resp),"%s:%s:%s", a1_hash, newnonce, a2_hash); + ast_md5_hash(resp_hash, resp); + } + /* only include the opaque string if it's set */ if (!ast_strlen_zero(p->opaque)) { snprintf(opaque, sizeof(opaque), ", opaque=\"%s\"", p->opaque);