Steven Sokol wrote:
I'm working on adding URL support to IAX Phone.  It will simply pop the
default browser with the URL.  The bigger question is: how do you want to go
about _sending_ the URLs?  Copy/paste/send?

Click a button that pops up a dialog asking you to enter the URL?
The dialog box could contain a set of "Speed Dial URLs" for commonly
transmitted info.  It could also contain a drop-down list for recently sent
URLs.  Would that work?

Thanks,

Steve



Well, here is my current patch to libiaxclient. As you will see, it does not support sending an URL from the client, just receiving URL which may be sent by * via Dial+URL (or Queue+URL), usefull in call center environment.
I don't really know how to best handle sending an URL from the client, but copy/paste/send seems ok to me.



Thanks,

--
Jean-Denis Girard

====================================================
Essential Software - Ing�nierie Informatique
Solutions Linux & Open Source en Polyn�sie fran�aise
----------------------------------------------------
http://www.esoft.pf/
T�l: (689) 54 12 95
====================================================
diff -Naur iaxclient-20040617/lib/iaxclient.h iaxclient-20040617-JDG/lib/iaxclient.h
--- iaxclient-20040617/lib/iaxclient.h  2004-06-10 14:01:23.000000000 -1000
+++ iaxclient-20040617-JDG/lib/iaxclient.h      2004-06-17 14:40:30.135164832 -1000
@@ -47,6 +47,7 @@
 #define IAXC_EVENT_TEXT                        1
 #define IAXC_EVENT_LEVELS              2
 #define IAXC_EVENT_STATE               3
+#define IAXC_EVENT_URL                 4       /* URL push via IAX(2) */
 
 #define IAXC_CALL_STATE_FREE           0
 #define IAXC_CALL_STATE_ACTIVE                 (1<<1)
@@ -62,7 +63,11 @@
 #define IAXC_TEXT_TYPE_FATALERROR      4
 #define IAXC_TEXT_TYPE_IAX             5
 
-
+#define IAXC_URL_URL                           1       /* URL received */
+#define IAXC_URL_LDCOMPLETE    2       /* URL loading complete */
+#define IAXC_URL_LINKURL               3       /* URL link request */
+#define IAXC_URL_LINKREJECT    4       /* URL link reject */
+#define IAXC_URL_UNLINK                        5       /* URL unlink */
 
 #define IAXC_EVENT_BUFSIZ      256
 struct iaxc_ev_levels {
@@ -85,12 +90,19 @@
        char local_context[IAXC_EVENT_BUFSIZ];
 };
 
+struct iaxc_ev_url {
+       int callNo;
+       int type;
+       char url[IAXC_EVENT_BUFSIZ];
+};
+
 typedef struct iaxc_event_struct {
        int type;
        union {
                struct iaxc_ev_levels           levels;
                struct iaxc_ev_text             text;
                struct iaxc_ev_call_state       call;
+               struct iaxc_ev_url              url;
        } ev;
 } iaxc_event;
 
diff -Naur iaxclient-20040617/lib/iaxclient_lib.c 
iaxclient-20040617-JDG/lib/iaxclient_lib.c
--- iaxclient-20040617/lib/iaxclient_lib.c      2004-06-10 14:01:23.000000000 -1000
+++ iaxclient-20040617-JDG/lib/iaxclient_lib.c  2004-06-17 14:40:30.136164680 -1000
@@ -509,6 +509,52 @@
     iaxc_post_event(ev);
 }
 
+/* handle IAX URL events */
+void handle_url_event( struct iax_event *e, int callNo ) {
+       iaxc_event ev;
+
+       if(callNo < 0) return;
+
+       ev.ev.url.callNo = callNo;
+       ev.type = IAXC_EVENT_URL;
+       strcpy( ev.ev.url.url, "" );
+
+       switch( e->subclass ) {
+               case AST_HTML_URL:
+                       ev.ev.url.type = IAXC_URL_URL;
+                       if( e->datalen ) {
+                               if( e->datalen > IAXC_EVENT_BUFSIZ ) {
+                                       fprintf( stderr, "ERROR: URL too long %d > 
%d\n", 
+                                                       e->datalen, IAXC_EVENT_BUFSIZ 
);
+                               } else {
+                                       strncpy( ev.ev.url.url, e->data, e->datalen );
+                               }
+                       }
+                       fprintf( stderr, "URL:%s\n", ev.ev.url.url );
+                       break;
+               case AST_HTML_LINKURL:
+                       ev.ev.url.type = IAXC_URL_LINKURL;
+                       fprintf( stderr, "LINKURL event\n" );
+                       break;
+               case AST_HTML_LDCOMPLETE:
+                       ev.ev.url.type = IAXC_URL_LDCOMPLETE;
+                       fprintf( stderr, "LDCOMPLETE event\n" );
+                       break;
+               case AST_HTML_UNLINK:
+                       ev.ev.url.type = IAXC_URL_UNLINK;
+                       fprintf( stderr, "UNLINK event\n" );
+                       break;
+               case AST_HTML_LINKREJECT:
+                       ev.ev.url.type = IAXC_URL_LINKREJECT;
+                       fprintf( stderr, "LINKREJECT event\n" );
+                       break;
+               default:
+                       fprintf( stderr, "Unknown URL event %d\n", e->subclass );
+                       break;
+       }
+    iaxc_post_event( ev );
+}
+
 void handle_audio_event(struct iax_event *e, int callNo) {
        int total_consumed = 0;
        int cur;
@@ -599,6 +645,9 @@
                case IAX_EVENT_PONG:  /* we got a pong */
                        //fprintf(stderr, "**********GOT A PONG!\n");
                        break;
+               case IAX_EVENT_URL:
+                       handle_url_event(e, callNo);
+                       break;
                default:
                        iaxc_usermsg(IAXC_STATUS, "Unknown event: %d for call %d", 
e->etype, callNo);
                        break;
diff -Naur iaxclient-20040617/lib/libiax2/src/iax.c 
iaxclient-20040617-JDG/lib/libiax2/src/iax.c
--- iaxclient-20040617/lib/libiax2/src/iax.c    2004-06-17 14:37:02.586716992 -1000
+++ iaxclient-20040617-JDG/lib/libiax2/src/iax.c        2004-06-17 14:40:30.137164528 
-1000
@@ -1944,6 +1944,8 @@
                        case AST_HTML_URL:
                                if (!e->etype)
                                        e->etype = IAX_EVENT_URL;
+                               e->subclass = fh->csub;
+                               e->datalen = datalen;
                                if (datalen) {
                                        memcpy(e->data, fh->iedata, datalen);
                                }

Reply via email to