Skip to content

Commit

Permalink
bevent: add enum ev to event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed May 21, 2024
1 parent 53d9c1b commit 8ce80f0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/baresip.h
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ enum answer_method {
/** Defines the User-Agent event handler */
typedef void (ua_event_h)(struct ua *ua, enum ua_event ev,
struct call *call, const char *prm, void *arg);
typedef void (bevent_h)(struct bevent *event, void *arg);
typedef void (bevent_h)(enum ua_event ev, struct bevent *event, void *arg);
typedef void (options_resp_h)(int err, const struct sip_msg *msg, void *arg);
typedef void (refer_resp_h)(int err, const struct sip_msg *msg, void *arg);

Expand Down
3 changes: 1 addition & 2 deletions modules/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static void process_module_event(struct call *call, const char *prm)
}


static void event_handler(struct bevent *event, void *arg)
static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
{
struct call *call2 = NULL;
int32_t adelay = -1;
Expand All @@ -661,7 +661,6 @@ static void event_handler(struct bevent *event, void *arg)
uint32_t count;
struct pl val;
char * uri;
enum ua_event ev = bevent_get_enum(event);
const char *prm = bevent_get_text(event);
struct call *call = bevent_get_call(event);
struct ua *ua = bevent_get_ua(event);
Expand Down
2 changes: 1 addition & 1 deletion src/bevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static void bevent_emit_base(struct bevent *event)
struct ehe *ehe = le->data;
le = le->next;

ehe->h(event, ehe->arg);
ehe->h(event->ev, event, ehe->arg);

if (event->stop)
return;
Expand Down
3 changes: 1 addition & 2 deletions test/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,13 @@ static void process_rules(struct agent *ag, enum ua_event ev, const char *prm)
}


static void event_handler(struct bevent *event, void *arg)
static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
{
struct fixture *f = arg;
struct call *call2 = NULL;
struct agent *ag;
struct stream *strm = NULL;
char curi[256];
enum ua_event ev = bevent_get_enum(event);
const char *prm = bevent_get_text(event);
struct call *call = bevent_get_call(event);
struct ua *ua = bevent_get_ua(event);
Expand Down
3 changes: 1 addition & 2 deletions test/ua.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ static void test_abort(struct test *t, int err)
}


static void event_handler(struct bevent *event, void *arg)
static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
{
struct test *t = arg;
size_t i;
enum ua_event ev = bevent_get_enum(event);
const char *prm = bevent_get_text(event);
struct call *call = bevent_get_call(event);
struct ua *ua = bevent_get_ua(event);
Expand Down

0 comments on commit 8ce80f0

Please sign in to comment.