121
121
static int mhomed_sock_cache_disabled = 0;
122
122
static int sock_inet = -1;
124
123
static int sock_inet6 = -1;
125
#endif /* USE_IPV6 */
127
125
static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
333
327
case AF_INET: send_sock=sendipv4_tcp;
336
329
case AF_INET6: send_sock=sendipv6_tcp;
339
331
default: LOG(L_ERR, "get_send_socket: BUG: don't know how"
340
332
" to forward to af %d\n", to->s.sa_family);
349
341
case AF_INET: send_sock=sendipv4_tls;
352
343
case AF_INET6: send_sock=sendipv6_tls;
355
345
default: LOG(L_ERR, "get_send_socket: BUG: don't know how"
356
346
" to forward to af %d\n", to->s.sa_family);
365
355
switch(to->s.sa_family){
366
356
case AF_INET: send_sock=sendipv4_sctp;
369
358
case AF_INET6: send_sock=sendipv6_sctp;
372
360
default: LOG(L_ERR, "get_send_socket: BUG: don't know"
373
361
" how to forward to af %d\n",
374
362
to->s.sa_family);
383
371
switch(to->s.sa_family){
384
372
case AF_INET: send_sock=sendipv4;
387
374
case AF_INET6: send_sock=sendipv6;
390
376
default: LOG(L_ERR, "get_send_socket: BUG: don't know"
391
377
" how to forward to af %d\n",
392
378
to->s.sa_family);
551
537
send_info->send_flags=msg->fwd_send_flags;
552
/* calculate branch for outbound request; if syn_branch is turned off,
538
/* calculate branch for outbound request;
553
539
calculate is from transaction key, i.e., as an md5 of From/To/CallID/
554
540
CSeq exactly the same way as TM does; good for reboot -- than messages
555
541
belonging to transaction lost due to reboot will still be forwarded
556
542
with the same branch parameter and will be match-able downstream
558
if it is turned on, we don't care about reboot; we simply put a simple
559
value in there; better for performance
562
memcpy(msg->add_to_branch_s, "z9hG4bKcydzigwkX", 16);
563
msg->add_to_branch_len=16;
565
if (!char_msg_val( msg, md5 )) { /* parses transaction key */
566
LOG(L_ERR, "ERROR: forward_request: char_msg_val failed\n");
570
msg->hash_index=hash( msg->callid->body, get_cseq(msg)->number);
571
if (!branch_builder( msg->hash_index, 0, md5, 0 /* 0-th branch */,
572
msg->add_to_branch_s, &msg->add_to_branch_len )) {
573
LOG(L_ERR, "ERROR: forward_request: branch_builder failed\n");
544
if (!char_msg_val( msg, md5 )) { /* parses transaction key */
545
LOG(L_ERR, "ERROR: forward_request: char_msg_val failed\n");
549
msg->hash_index=hash( msg->callid->body, get_cseq(msg)->number);
550
if (!branch_builder( msg->hash_index, 0, md5, 0 /* 0-th branch */,
551
msg->add_to_branch_s, &msg->add_to_branch_len )) {
552
LOG(L_ERR, "ERROR: forward_request: branch_builder failed\n");
578
556
/* try to send the message until success or all the ips are exhausted
579
557
* (if dns lookup is performed && the dns cache used ) */