diff options
author | John Crispin <blogic@openwrt.org> | 2011-02-07 21:47:54 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2011-02-07 21:47:54 +0000 |
commit | 116b670106681d51fac23d31b80aec695f1759fa (patch) | |
tree | 5c31bcc2a016b95e050fc7e3ee1dc2a4d2e3db35 /package/tapi_sip/src/tapi_agent.c | |
parent | d3dddd3f7ed259534b7a71ad6b0f8e3ec7e52291 (diff) | |
download | master-187ad058-116b670106681d51fac23d31b80aec695f1759fa.tar.gz master-187ad058-116b670106681d51fac23d31b80aec695f1759fa.tar.bz2 master-187ad058-116b670106681d51fac23d31b80aec695f1759fa.zip |
[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
Diffstat (limited to 'package/tapi_sip/src/tapi_agent.c')
-rw-r--r-- | package/tapi_sip/src/tapi_agent.c | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/package/tapi_sip/src/tapi_agent.c b/package/tapi_sip/src/tapi_agent.c deleted file mode 100644 index 93c73c24d8..0000000000 --- a/package/tapi_sip/src/tapi_agent.c +++ /dev/null @@ -1,105 +0,0 @@ - -#include <stdbool.h> -#include <stdio.h> -#include <tapi-port.h> - -#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); -} |