MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / update_event_subscriptions

Function update_event_subscriptions

modules/freeswitch/fs_proc.c:434–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434int update_event_subscriptions(fs_evs *sock)
435{
436 struct list_head *_, *__;
437 struct fs_event *event;
438 int rc, ret = 0;
439
440 lock_start_write(sock->lists_lk);
441
442 /* handle any pending event actions */
443 list_for_each_safe(_, __, &sock->events) {
444 event = list_entry(_, struct fs_event, list);
445 LM_DBG("process event %s, refsum: %d, action: %d\n", event->name.s,
446 event->refsum, event->action);
447
448 if (event->refsum > 0 && event->action == FS_EVENT_SUB) {
449 LM_DBG("subscribing to %s events on %s:%d\n",
450 event->name.s, sock->host.s, sock->port);
451
452 rc = w_esl_send_recv(sock->handle, &event->name, ESL_EVENT_SUB);
453 switch (rc) {
454 case -1:
455 LM_ERR("error while subscribing to %s on ESL sock %s:%d\n",
456 event->name.s, sock->host.s, sock->port);
457 ret++;
458 continue;
459 case 1:
460 LM_ERR("ESL replied '%s' when we subscribed for %s on sock "
461 "%s:%d\n", sock->handle->last_sr_reply, event->name.s,
462 sock->host.s, sock->port);
463 ret++;
464 continue;
465 }
466
467 LM_INFO("subscribed to %s events on FS sock %s:%d\n",
468 event->name.s, sock->host.s, sock->port);
469 event->action = FS_EVENT_NOP;
470 }
471
472 if (event->refsum == 0 && event->action == FS_EVENT_UNSUB) {
473 LM_DBG("unsubscribing from %s events on %s:%d\n",
474 event->name.s, sock->host.s, sock->port);
475
476 rc = w_esl_send_recv(sock->handle, &event->name, ESL_EVENT_UNSUB);
477 switch (rc) {
478 case -1:
479 LM_ERR("error while unsubbing from %s on ESL sock %s:%d\n",
480 event->name.s, sock->host.s, sock->port);
481 ret++;
482 continue;
483 case 1:
484 LM_ERR("ESL replied '%s' when we unsubbed from %s on sock "
485 "%s:%d\n", sock->handle->last_sr_reply, event->name.s,
486 sock->host.s, sock->port);
487 ret++;
488 continue;
489 }
490
491 LM_INFO("unsubscribed from %s events on FS sock %s:%d\n",

Callers 1

apply_socket_commandsFunction · 0.85

Calls 3

list_for_each_safeFunction · 0.85
w_esl_send_recvFunction · 0.85
list_entryClass · 0.50

Tested by

no test coverage detected