From 701b046a45c2c79cc6d07ac3a4f84f499f7ed376 Mon Sep 17 00:00:00 2001 From: Super User Date: Thu, 26 Jul 2007 14:23:56 +0200 Subject: unified socket application interface (for asterisk and maybe other apps) bugfixes --- asterisk_client.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'asterisk_client.c') diff --git a/asterisk_client.c b/asterisk_client.c index def6545..13ab261 100644 --- a/asterisk_client.c +++ b/asterisk_client.c @@ -9,6 +9,25 @@ ** ** \*****************************************************************************/ +/* + +How does it work: + +To connect, open a socket and send a MESSAGE_HELLO to admin socket with +the application name. This name is unique an can be used for routing calls. + +To make a call, send a MESSAGE_NEWREF and a new reference is received. +When receiving a call, a new reference is received. +The reference is received with MESSAGE_NEWREF. + +Make a MESSAGE_SETUP or receive a MESSAGE_SETUP with the reference. + +To release call and reference, send or receive MESSAGE_RELEASE. +From that point on, the ref is not valid, so no other message may be sent +with that reference. + +*/ + #include #include #include @@ -138,7 +157,7 @@ int main(int argc, char *argv[]) struct sockaddr_un sock_address; int ret; unsigned long on = 1; - union parameter hello_param; + union parameter param; /* open socket */ if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) @@ -169,8 +188,9 @@ int main(int argc, char *argv[]) } /* enque hello message */ - memset(&hello_param, 0, sizeof(hello_param)); - admin_asterisk(MESSAGE_HELLO, &hello_param); + memset(¶m, 0, sizeof(param)); + SCPY(param.hello.application, "asterisk"); + admin_asterisk(MESSAGE_HELLO, ¶m); while(42) { -- cgit v1.2.3-55-g7522