From 888927ac1c34c9b49f6f2b1808851c8eefe8fdda Mon Sep 17 00:00:00 2001 From: blogic Date: Mon, 7 Feb 2011 21:47:54 +0000 Subject: [voip] * drop libtapi and tapi_sip (moved to external git) * add build variants to pjsip * split tapi_dev audio driver out of patch into src/ git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25412 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/tapi_sip/src/tapi_agent.c | 105 -------------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 package/tapi_sip/src/tapi_agent.c (limited to 'package/tapi_sip/src/tapi_agent.c') diff --git a/package/tapi_sip/src/tapi_agent.c b/package/tapi_sip/src/tapi_agent.c deleted file mode 100644 index 93c73c24d..000000000 --- a/package/tapi_sip/src/tapi_agent.c +++ /dev/null @@ -1,105 +0,0 @@ - -#include -#include -#include - -#include "session.h" -#include "agent.h" -#include "tapi_agent.h" - -static int tapi_agent_invite(struct agent *agent, struct session *session) -{ - struct tapi_agent *tagent = agent_to_tapi_agent(agent); - - if (tagent->session) - return -1; - - tagent->state = TAPI_AGENT_STATE_RINGING; - tapi_port_set_ring(&tagent->port, true); - - tagent->session = session; - - return 0; -} - -static int tapi_agent_accept(struct agent *agent, struct session *session) -{ - return 0; -} - -static int tapi_agent_hangup(struct agent *agent, struct session *session) -{ - struct tapi_agent *tagent = agent_to_tapi_agent(agent); - - switch (tagent->state) { - case TAPI_AGENT_STATE_RINGING: - tapi_port_set_ring(&tagent->port, false); - break; - default: - break; - } - - tagent->state = TAPI_AGENT_STATE_IDLE; - tagent->session = NULL; - - return 0; -} - -static int tapi_agent_get_endpoint(struct agent *agent, struct session *session) -{ - struct tapi_agent *tagent = agent_to_tapi_agent(agent); - return tapi_port_get_endpoint(&tagent->port); -} - -static const struct agent_ops tapi_agent_ops = { - .invite = tapi_agent_invite, - .accept = tapi_agent_accept, - .hangup = tapi_agent_hangup, - .get_endpoint = tapi_agent_get_endpoint, -}; - -static void tapi_agent_event(struct tapi_port *port, struct tapi_event *event, - void *data) -{ - struct tapi_agent *tagent = data; - - if (event->type != TAPI_EVENT_TYPE_HOOK) - return; - - if (!tagent->session) - return; - - if (event->hook.on) { - session_hangup(tagent->session, &tagent->agent); - tagent->state = TAPI_AGENT_STATE_IDLE; - tagent->session = NULL; - } else { - session_accept(tagent->session, &tagent->agent); - tagent->state = TAPI_AGENT_STATE_ACTIVE; - } -} - -void tapi_agent_init(struct tapi_device *tdev, int port, struct tapi_agent *tagent) -{ - int ret; - - tagent->agent.ops = &tapi_agent_ops; - tagent->state = TAPI_AGENT_STATE_IDLE; - tagent->session = NULL; - - ret = tapi_port_open(tdev, port, &tagent->port); - if (ret) { - printf("Failed to open tapi port %d: %d\n", port, ret); - return; - } - - tagent->event_listener.callback = tapi_agent_event; - tagent->event_listener.data = tagent; - - tapi_port_register_event(&tagent->port, &tagent->event_listener); -} - -void tapi_agent_free(struct tapi_agent *tagent) -{ - tapi_port_unregister_event(&tagent->port, &tagent->event_listener); -} -- cgit v1.2.3