[ale] Still dealing with Nextel
wrnash
wrnash at wrnash.net
Fri Jan 24 10:11:36 EST 2003
A bit off topic but have you tried qpage to send information to Nextel.
Bill Nash
-----Original Message-----
From: ale-admin at ale.org [mailto:ale-admin at ale.org] On Behalf Of cfowler
To: ale at ale.org
Sent: Thursday, January 23, 2003 1:10 PM
To: ale at ale.org
Subject: Re: [ale] Still dealing with Nextel
/**
* Funtion will send a page to SNPP server
*
* @param snpp Pointer to snpp configuration
* @param message Pointer to char array dit message
*
* @return int 0 on success -1 on error
* */
int
sendSnppPage(struct snpp *s, const char *message)
{
struct sockaddr_in server; // Server info
char buffer[1024]; // Incoming buffer
int sock;
char *ptr;
// Configure the connection info
server.sin_family = AF_INET;
server.sin_port = htons(s->port ? s->port : 444); // If port is 0
default to 444
server.sin_addr.s_addr = inet_addr(ip2sip(s->snppServer));
memset(&(server.sin_zero), '\0' , 8);
// Create our connection
if((sock = socket(AF_INET, SOCK_STREAM,0)) == -1)
return -1;
if(connect(sock, (struct sockaddr *)&server, sizeof(struct
sockaddr)) == -1)
return -1;
// Read the ffirst message
ptr = readPeer(buffer, sock, sizeof(buffer));
snppDebug(ptr);
if(getCode(ptr) != 220)
return -1;
// Send the PAGE Command
snprintf(buffer, sizeof(buffer), "PAGE %s\r\n", s->id);
write(sock, buffer, strlen(buffer));
ptr = readPeer(buffer, sock, sizeof(buffer));
snppDebug(ptr);
if(getCode(ptr) != 250)
return -1;
// Send the message
write(sock, "MESS ", 5);
write(sock, message, strlen(message));
write(sock, "\r\n", 2);
ptr = readPeer(buffer, sock, sizeof(buffer));
snppDebug(ptr);
if(getCode(ptr) != 250)
return -1;
write(sock, "SEND\r\n ", 6);
ptr = readPeer(buffer, sock, sizeof(buffer));
snppDebug(ptr);
if(getCode(ptr) != 250)
return -1;
// Terminate the conenction gracefully with the
// SNPP server
write(sock, "QUIT\r\n ", 6);
// No longer need this data
close(sock);
return 0;
}
static char *
readPeer(char *buffer, int sock, int num)
{
char *ptr;
int n;
if((n = read(sock, buffer, num)) <= 0)
return NULL;
// Strip out a New line
if((ptr = strchr(buffer, '\n')) != NULL)
*ptr = 0;
// Strip out a carriage return
if((ptr = strchr(buffer, '\r')) != NULL)
*ptr = 0;
ptr = buffer;
return ptr;
}
static int
getCode(const char *message)
{
char ptr[3] = { 0 };
if(!message || *message == 0)
return 0;
if(strlen(message) < 3)
return 0;
ptr[0] = message[0];
ptr[1] = message[1];
ptr[2] = message[2];
return atoi(ptr);
}
That is all you need.
This is the client
int
main(int argc, char **argv) {
strunct snpp *s;
s->ip = argv[1];
s->port = atoi(argv[2);
s->phone = argv[3]);
sendSnppPage(&s, "Call Me");
return;
}
Of course this code needs tweaking. The main funciton that is
On Thu, 2003-01-23 at 12:52, Robert L. Harris wrote:
>
>
> I'm looking at the Net::SNPP module which appears a bit incomplete. I
> don't know java so I'm running with perl. Looks like I'll be using
> perl::expect since the Net::SNPP is complaining about missing or
> undefined arguements when I'm running cut and paste (except for pager
> number, etc) from the man page.
>
>
> Thus spake cfowler (cfowler at outpostsentinel.com):
>
> > Who needs a stinkin client?. SNPP, SMTP, and POP3 and what I would
call
> > transaction based interfaces. This makes SNPP that more awesome.
It
> > means you can interface with telnet, Java, Perl, or even C.
> >
> > Basically in Java do this:
> >
> > try {
> > Socket s = new Socket("snpp.nextel.com", 443);
> > BufferedInputStream bis = new
BufferedInputStream(s.getInputStream());
> > BufferedOutputStream bos = new
> > BufferedOutputStream(s.getOutputStream());
> >
> > // Know we have stream
> > String s = bis.readLine();
> >
> >
> > PAGE <Number>
> > MESS <message>
> > SEND
> > QUIT
> >
> > // MAke sure after sending each command you get a 2XX respoinse
back.
> > Just check the first 3 bytes in the bis.readLine() and convert to an
> > integer. Then you can check the the number against 2XX.
> >
> > Example Page I just did to Nextel, your carrier
> >
> >
> > [cfowler at cfowler - CHROOT insmod]$ telnet snpp.nextel.com 444
> > Trying 170.206.252.7...
> > Connected to snpp.nextel.com.
> > Escape character is '^]'.
> > 220 SNPP Gateway Ready
> > page 7705601050
> > 250 Pager ID Accepted
> > MESS Call me
> > 250 Message OK
> > SEND
> > 250 Message Sent Successfully
> > QUIT
> > 221 OK, Goodbye
> > Connection closed by foreign host.
> >
> > With ease of use like that, who needs freshmeat to solve this one?
> >
> >
> > That simple.
> >
> >
> >
> > On Thu, 2003-01-23 at 12:25, Robert L. Harris wrote:
> > >
> > >
> > > Got a good linux client?
> > >
> > > Thus spake cfowler (cfowler at outpostsentinel.com):
> > >
> > > > SNPP
> > > >
> > > > Nextel supports it!
> > > >
> > > > On Thu, 2003-01-23 at 09:50, Robert L. Harris wrote:
> > > > >
> > > > >
> > > > > Ok, I'm still arguing with nextel about emailing to their
messaging
> > > > > servers. Talking to their techs is along the lines of
explaining
> > > > > nuclear fusion t a chicken I've surmised.
> > > > >
> > > > > I'm trying to narrow down the argument here as much as
possible.
> > > > >
> > > > > The scenario:
> > > > > From my office I can email to <phone>@messaging.nextel.com
and get a
> > > > > page within 2 mins
> > > > > From my home (*.rdlg.net) any email to messaging.nextel.com
times out
> > > > > and is never deleivered.
> > > > >
> > > > > I've been told to email to paging.nextel.com instead, but
see'ing as
> > > > > it has the same MX servers there's not much difference.
Telnet to
> > > > > port 25 on the MX connects from my office but not from
home. (At this
> > > > > point I'm told they don't use telnet to send messages,
they use an email
> > > > > to SMS gateway... BAWK!!!!)
> > > > >
> > > > > I've tested with my firewall completely dropped, no change
in
> > > > > behavior.
> > > > >
> > > > > Anyone have any thoughts on this? It's become one of those
fights I
> > > > > just can't give up as it's now a matter of principle...
> > > > >
> > > > > Robert
> > > > >
> > > > >
> > > > > :wq!
> > > > >
------------------------------------------------------------------------
---
> > > > > Robert L. Harris | PGP Key ID: FC96D405
> > > > >
> > > > > DISCLAIMER:
> > > > > These are MY OPINIONS ALONE. I speak for no-one else.
> > > > > FYI:
> > > > > perl -e 'print
$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Ale mailing list
> > > > Ale at ale.org
> > > > http://www.ale.org/mailman/listinfo/ale
> > >
> > >
> > >
> > > :wq!
> > >
------------------------------------------------------------------------
---
> > > Robert L. Harris | PGP Key ID: FC96D405
> > >
> > > DISCLAIMER:
> > > These are MY OPINIONS ALONE. I speak for no-one else.
> > > FYI:
> > > perl -e 'print
$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
> > >
> >
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
>
>
>
> :wq!
>
------------------------------------------------------------------------
---
> Robert L. Harris | PGP Key ID: FC96D405
>
> DISCLAIMER:
> These are MY OPINIONS ALONE. I speak for no-one else.
> FYI:
> perl -e 'print
$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
>
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list