handle notify replies internally

This commit is contained in:
Richard Aas 2011-12-16 13:26:10 +00:00
parent ea52ebc9f4
commit f9a2aa88a4
3 changed files with 7 additions and 12 deletions

View file

@ -77,8 +77,7 @@ struct sipsub;
typedef int (sipevent_fork_h)(struct sipsub **subp, struct sipsub *osub,
const struct sip_msg *msg, void *arg);
typedef void (sipevent_notify_h)(struct sip *sip, const struct sip_msg *msg,
void *arg);
typedef void (sipevent_notify_h)(const struct sip_msg *msg, void *arg);
int sipevent_subscribe(struct sipsub **subp, struct sipevent_sock *sock,
const char *uri, const char *from_name,

View file

@ -192,13 +192,11 @@ static void notify_handler(struct sipevent_sock *sock,
(void)sip_dialog_update(sub->dlg, msg);
}
(void)sip_treply(NULL, sip, msg, 200, "OK");
if (sub->refer_cseq >= 0 && !sub->id && pl_isset(&event.id)) {
err = pl_strdup(&sub->id, &event.id);
if (err) {
(void)sip_treply(NULL, sip, msg, 500, strerror(err));
return;
}
(void)pl_strdup(&sub->id, &event.id);
}
re_printf("notify: %s (%r)\n", sipevent_substate_name(state.state),
@ -220,7 +218,7 @@ static void notify_handler(struct sipevent_sock *sock,
}
mem_ref(sub);
sub->notifyh(sip, msg, sub->arg);
sub->notifyh(msg, sub->arg);
nrefs = mem_nrefs(sub);
mem_deref(sub);

View file

@ -29,12 +29,10 @@ enum {
static int request(struct sipsub *sub, bool reset_ls);
static void internal_notify_handler(struct sip *sip, const struct sip_msg *msg,
void *arg)
static void internal_notify_handler(const struct sip_msg *msg, void *arg)
{
(void)msg;
(void)arg;
(void)sip_treply(NULL, sip, msg, 200, "OK");
}