Commit ffa103b3 authored by Pekka Pessi's avatar Pekka Pessi

Using parameter manipulation functions and shortcuts.

darcs-hash:20051222141550-65a35-5f4d38e223910d738fe775853fef6d9f8640e749.gz
parent 2e777594
......@@ -531,9 +531,8 @@ int handle_notify(nea_t *nea,
char const *retry_after;
sip_time_t retry = sip_now() + NEA_TIMER_DELTA;
retry_after = msg_params_find(ss->ss_params, "retry-after=");
if (retry_after)
retry += strtoul(retry_after, NULL, 10);
if (ss->ss_retry_after)
retry += strtoul(ss->ss_retry_after, NULL, 10);
else
retry += NEA_TIMER_DELTA;
......
......@@ -1758,9 +1758,9 @@ int nta_tpn_by_via(tp_name_t *tpn, sip_via_t const *v, int *using_rport)
if (v->v_maddr || !using_rport)
rport = NULL;
else if (strcasecmp(v->v_protocol, "SIP/2.0/UDP") == 0)
rport = msg_params_find(v->v_params, "rport="), *using_rport = 0;
rport = v->v_rport, *using_rport = 0;
else if (*using_rport)
rport = msg_params_find(v->v_params, "rport=");
rport = v->v_rport;
else
rport = NULL;
......@@ -1923,9 +1923,9 @@ void agent_recv_request(nta_agent_t *agent,
if (stream &&
tport_can_send_sigcomp(tport) &&
tport_name(tport)->tpn_comp == NULL &&
msg_params_find(sip->sip_via->v_params, "comp=sigcomp") &&
tport_has_compression(tport_parent(tport), "sigcomp")) {
tport_set_compression(tport, "sigcomp");
sip->sip_via->v_comp &&
tport_has_compression(tport_parent(tport), sip->sip_via->v_comp)) {
tport_set_compression(tport, sip->sip_via->v_comp);
}
#endif
......
......@@ -736,12 +736,12 @@ int test_tports(agent_t *ag)
v_udp_only = v;
udp = 1;
if (udp_comp == NULL)
udp_comp = msg_params_find(v->v_params, "comp=");
udp_comp = v->v_comp;
}
else if (strcasecmp(v->v_protocol, sip_transport_tcp) == 0) {
tcp = 1;
if (tcp_comp == NULL)
tcp_comp = msg_params_find(v->v_params, "comp=");
tcp_comp = v->v_comp;
}
else if (strcasecmp(v->v_protocol, sip_transport_sctp) == 0) {
sctp = 1;
......
......@@ -2217,7 +2217,7 @@ int dialog_is_established(struct nua_dialog_state const *ds)
/** Refer usage */
static sip_event_t const first_refer_usage[1] =
{{{ 0, 0, sip_event_class, 0, 0 }, 0, "refer" }};
{{{{ 0, 0, sip_event_class, 0, 0 }}, 0, "refer" }};
/** UAS tag and route */
static
......@@ -6183,6 +6183,8 @@ ua_notify(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
;
else if (sip->sip_subscription_state) {
char const *ss_substate = sip->sip_subscription_state->ss_substate;
sip_time_t now = sip_now();
if (strcasecmp(ss_substate, "terminated") == 0)
du->du_notifier->de_substate = nua_substate_terminated;
else if (strcasecmp(ss_substate, "pending") == 0)
......@@ -6195,7 +6197,19 @@ ua_notify(nua_t *nua, nua_handle_t *nh, nua_event_t e, tagi_t const *tags)
expires = strtoul(sip->sip_subscription_state->ss_expires, NULL, 10);
if (expires > 3600)
expires = 3600;
du->du_common->cu_refresh = sip_now() + expires;
du->du_common->cu_refresh = now + expires;
}
else if (du->du_subscriber->de_substate != nua_substate_terminated) {
sip_subscription_state_t *ss = sip->sip_subscription_state;
char *param;
if (now < du->du_common->cu_refresh)
param = su_sprintf(msg_home(msg), "expires=%lu",
du->du_common->cu_refresh - now);
else
param = "expires=0";
msg_header_add_param(msg_home(msg), ss->ss_common, param);
}
}
else {
......@@ -6350,12 +6364,10 @@ static int process_notify(nua_t *nua,
retry = 0;
}
else if (str0casecmp(subs->ss_reason, why = "probation") == 0) {
char const *retry_after;
du->du_subscriber->de_substate = nua_substate_embryonic;
retry = 30;
retry_after = msg_params_find(subs->ss_params, "retry-after=");
if (retry_after)
retry = strtoul(retry_after, NULL, 10);
if (subs->ss_retry_after)
retry = strtoul(subs->ss_retry_after, NULL, 10);
}
else
why = subs->ss_reason;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment