[Freeswitch-users] Unified logging of incoming mobile calls - partial solution for android

Avi Marcus avi at avimarcus.net
Mon Nov 21 01:06:30 MSK 2011


I know many people run/use a PBX of some sort, and I figured I'd share what
I discovered:
I have a mobile phone that gets a lot of calls directly, but I wanted to
log those calls to a CRM.

This is a partial solution.. Android Notifier (
http://code.google.com/p/android-notifier/) is an app that can be installed
on the android and send a UDP message to a server (or also to a desktop
client) when calls come in. The desktop client can launch a website to pull
data for a screen pop of some sort....
It seemed to sometimes lose sync (when wifi went off and then came back..)
but it's got the last 10 messages or so.

I have it send to UDP, and this small node.js script saves
the time-stamped messages to a file. (Note: timestamp is in milliseconds..)

//http://code.google.com/p/android-notifier/wiki/NotificationProtocol
> //DEVICE_ID/NOTIFICATION_ID/EVENT_TYPE/EVENT_CONTENTS
> var fs = require('fs');
> var log = fs.createWriteStream("incoming_call_log.txt", {'flags': 'a'} );
> var dgram = require("dgram");
> var server = dgram.createSocket("udp4");
> server.on("message", function (msg, rinfo) {
> //  console.log("server got: " + msg + " from " +  rinfo.address + ":" +
> rinfo.port);
> //  console.log("Got: " + Date.now() + "/" + rinfo.address +"/" +
> rinfo.port + "/" + msg);
>               log.write(Date.now() + "/" + rinfo.address +"/" + rinfo.port
> + "/" + msg +  "\n");
> });
> server.on("listening", function () {
>   var address = server.address();
>   console.log("server listening " +   address.address + ":" +
> address.port);
> });
> server.bind(10600, "YOUR IP");


And you can background and disown it, so it stays running.. after you
launch node.js.
Due to the abnormal method of submitting - not HTTP - I didn't know how to
write anything in another language to do this. I suppose you could do it
with python twisted.

And for a screenpop.. set the desktop notifier to launch:
/home/folder/web.sh "deviceId={deviceId}&id={id}&type={type}&data={data}"

web.sh contains:

> #!/bin/bash
> echo "$*"; #>> /tmp/websh.log; #logging...
> var=$*
> /usr/bin/chromium-browser "http://website.com/script.php?$var"


Anyway, this is just the basics. Feel free to share how you integrate it.
I didn't see the specs on how to decrypt the signal algorithimically, but
it's part of the desktop app.

-Avi Marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111121/2df6450d/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list