00001
00056 #include "../tm/tm_load.h"
00057 #include "../../dset.h"
00058
00059 #include "isc.h"
00060 #include "mod.h"
00061 #include "mark.h"
00062 #include "sip.h"
00063 #include "../scscf/scscf_load.h"
00064 #include "../../timer.h"
00066 extern struct tm_binds isc_tmb;
00068 extern str isc_my_uri;
00069 extern str isc_my_uri_sip;
00070 extern int isc_fr_timeout;
00071 extern int isc_fr_inv_timeout;
00084 int isc_forward( struct sip_msg *msg, isc_match *m,isc_mark *mark)
00085 {
00086 struct cell *t;
00087 unsigned int hash,label;
00088 ticks_t fr_timeout,fr_inv_timeout;
00089 DBG( "DEBUG:"M_NAME":isc_forward(): marking for AS <%.*s>\n",
00090 m->server_name.len, m->server_name.s );
00091
00092 isc_mark_set(msg,m,mark);
00093
00094 if (msg->dst_uri.s) pkg_free(msg->dst_uri.s);
00095 msg->dst_uri.s = pkg_malloc(m->server_name.len);
00096 if (!msg->dst_uri.s) {
00097 LOG(L_ERR,"ERR:"M_NAME":isc_forward(): error allocating %d bytes\n",m->server_name.len);
00098 return ISC_RETURN_ERROR;
00099 }
00100 msg->dst_uri.len = m->server_name.len;
00101 memcpy(msg->dst_uri.s,m->server_name.s,m->server_name.len);
00102
00103
00104 if (*isc_tmb.route_mode == MODE_ONFAILURE)
00105 append_branch(msg,msg->first_line.u.request.uri.s,msg->first_line.u.request.uri.len,
00106 msg->dst_uri.s,msg->dst_uri.len,0,0);
00107
00108
00109 cscf_get_transaction(msg,&hash,&label);
00110 t = isc_tmb.t_gett();
00111 fr_timeout = t->fr_timeout;
00112 fr_inv_timeout = t->fr_inv_timeout;
00113 t->fr_timeout=S_TO_TICKS(isc_fr_timeout)/1000;
00114 t->fr_inv_timeout=S_TO_TICKS(isc_fr_inv_timeout)/1000;
00115
00116
00117 isc_tmb.t_relay(msg,0,0);
00118
00119
00120 t->fr_timeout=fr_timeout;
00121 t->fr_inv_timeout=fr_inv_timeout;
00122
00123 LOG(L_INFO,"INFO:"M_NAME">> msg was fwded to AS\n");
00124
00125
00126
00127 return ISC_RETURN_TRUE;
00128 }