summaryrefslogtreecommitdiffstats
path: root/asterisk_client.c
diff options
context:
space:
mode:
authorSuper User2007-07-26 14:23:56 +0200
committerSuper User2007-07-26 14:23:56 +0200
commit701b046a45c2c79cc6d07ac3a4f84f499f7ed376 (patch)
tree0b534df0b08d2016f473fbee74bae36a010a7258 /asterisk_client.c
parentfixes & improvements (diff)
downloadlcr-701b046a45c2c79cc6d07ac3a4f84f499f7ed376.tar.gz
lcr-701b046a45c2c79cc6d07ac3a4f84f499f7ed376.tar.xz
lcr-701b046a45c2c79cc6d07ac3a4f84f499f7ed376.zip
unified socket application interface (for asterisk and maybe other apps)
bugfixes
Diffstat (limited to 'asterisk_client.c')
-rw-r--r--asterisk_client.c26
1 files changed, 23 insertions, 3 deletions
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 <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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(&param, 0, sizeof(param));
+ SCPY(param.hello.application, "asterisk");
+ admin_asterisk(MESSAGE_HELLO, &param);
while(42)
{