Skip site navigation (1)Skip section navigation (2)
Date:      14 Mar 98 09:27:06 +0100
From:      leifn@image.dk (Leif Neland)
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: email to PCN/GSM 1800 handphone.
Message-ID:  <a3b_9803140954@swimsuit.swimsuit.roskildebc.dk>

next in thread | raw e-mail | index | archive | help
At 14 Mar 98 04:14:24 Doug White wrote regarding Re: email to PCN/GSM 1800
handphone.

 >> it work quite well for me (using qpage v 3.2) and now I am
 >> looking for documents/FAQ/links/pogram on how
 >> to send a email to PCN / GSM 1800 / GSM 900 handphone, has
 >> anyone
 >> done this before ? Appreciate if you can tell me where I can
 >> get these software. I am testing it on FreeBSD 2.2.5 Release.

 DW> I would think that the phone service provider would provide this
 DW> service; ask them.
 DW>
 DW> On my PCS phone, you email the phonenumber@mobile.att.net.  AT&T
 DW> doesn't use GSM and the paging is a separate service but I bet
 DW> other companies use a similar style service.

It works so in Denmark too, so it is probably the general way to do it, even if
it might not be implemented yet everywhere.

However, here the phoneoperators also can sell you a dos/win-program, where you
enter the message, and then hit "send". The program then calls directly to a
modempool, and delivers the message, and get a statusreply immediately, just as
when you send a sms from the phone.

A service for dialing in and select one of 5 standard messages by the keypad of
the phone might also be interesting.

If you want to use sms for getting alarms, it is a catch-22, if you can't send
a message telling the router is dead because the router is dead... Then a modem
could be used to bypass the network and dial directly to one of the above
services.

I have made a program in Clipper (compiled dBase) because I have a nice
communication library. I'll include some of it here. I based it on some specs I
got from my telco.


  tp_open(1,,,19200,8,"N",1)
  send_modem(systemlevel(pSys_init1))
  tp_delay(1)
  send_modem(systemlevel(pSys_init2))
  dial("43625250")
  send_text(text)
  tp_close(1)

  tp_delay(10)

FUNCTION send_text(cString)
local cLine:="",n,ch
  cLine=format_msg("30/"+tlfnr+"///1//1////"+cLine)
  tp_send(1,cLine)
  tp_flush(1)
  procanswer()
  procanswer()
  ?"+"
RETURN NIL


PROCEDURE procanswer()
  local resline,type,result,rescode,i,n,ch,res1
  resline:=tp_recvto(1,chr(3),5000,10)
  if tp_error()!=0
    ? "-"
    return
  endif
  // ? "Resline: ",resline
  type:=parse(@resline,"/",,3)
  if type="R"
    result:=parse(@resline,"/",,2)
    rescode:=parse(@resline,"/",,2)
    if result=="A"
      ? "Besked sendt til",parse(@rescode,":"),"systemtid:"
      ?? substr(rescode,1,2)+"/"+substr(rescode,3,2)+"/"+substr(rescode,5,2)+"
"+;
     
substr(rescode,7,2)+":"+substr(rescode,9,2)+":"+substr(rescode,11,2)+"."+;
      substr(rescode,13,2)
    else
      ? "Besked fejlet: "
      do case

      case rescode=="01"
        ?? "Checksum error"
      case rescode=="02"
        ?? "Syntax error"
      case rescode=="03"
        ?? "Operation not supported by system"
      case rescode=="04"
        ?? "Operation not allowed"
      case rescode=="05"
        ?? "Call barring active"
      case rescode=="06"
        ?? "AdC invalid"
      case rescode=="07"
        ?? "Authentication failure"
      case rescode=="08"
        ?? "Legitimisation code for all calls, failure"
      case rescode=="09"
        ?? "GA not valid"
      case rescode=="10"
        ?? "Repetition not allowed"
      case rescode=="11"
        ?? "Legitimisation code for repetition, failure"
      case rescode=="12"
        ?? "Priority call not allowed"
      case rescode=="13"
         ?? "Legitimisation code for priority call, failure"
      case rescode=="14"
        ?? "Urgent message not allowed"
      case rescode=="15"
        ?? "Legitimisation code for urgent call, failure"
      case rescode=="16"
        ?? "Reverse charging not allowed"
      case rescode=="17"
        ?? "Legitimisation code for rev charging, failure"
      case rescode=="18"
        ?? "Deferred delivery not allowed"
      case rescode=="19"
        ?? "New AC not valid"
      case rescode=="20"
        ?? "New legitimisation code not valid"
      case rescode=="21"
        ?? "Standart text not valid"
      case rescode=="22"
        ?? "Time period not valid"
      case rescode=="23"
        ?? "Message type not supported by system"
      case rescode=="24"
        ?? "Message too long"
      case rescode=="25"
        ?? "Requested standard text not valid"
      case rescode=="26"
        ?? "Message type not valid for the pager type"
      otherwise
        ?? "Fejlkode: ",rescode
      endcase
    endif
  else
    result=parse(@resline,"/",,6)
    ?
    resline:=""
    for i:=1 to len(result)/2
      ch=chr(hex2dec(substr(result,2*i-1,2)))
      n:=at(ch,"{|}[\]")
      if n!=0
        ch=substr("æøåÆØÅ",n,1)
      endif
      resline+=ch
    next
    do while len(resline)>80
      res1=substr(resline,1,80)
      n=rat(" ",res1)
      ? substr(res1,1,n-1)
      resline:=substr(resline,n+1,999)
    enddo
    ? resline
  endif

    ?
    ?
return

FUNCTION format_msg(cBody)
static trn:=1
local cResult,i,csum:=0
cResult=chr(2)+padl(trn++,2,"0")+"/"+padl(14+len(cBody),5,"0")+"/O/"+cBody+"/"
for i:=2 to len(cResult)
  csum+=asc(substr(cResult,i))
next
cResult:=cResult+padl(dec2hex(csum%256),2,"0")+chr(3)
// ? cResult
RETURN cResult

FUNCTION nakmsg(cBody)
static trn:=1
local cResult,i,csum:=0
cResult=chr(2)+"00"+"/"+padl(14+len(cBody),5,"0")+"/R/"+cBody+"/"
for i:=2 to len(cResult)
  csum+=asc(substr(cResult,i))
next
cResult:=cResult+padl(dec2hex(csum%256),2,"0")+chr(3)
? cResult
RETURN cResult

PROCEDURE send_modem(cString)
  local k
  tp_waitproc( { |chunk| qqout(chunk) } )
  for k:=1 to 5
    tp_clearin(1)
    tp_send(1,cString+chr(13))
    ? cString
    ?
    if tp_waitfor(1,5,"OK","ERROR")==1
      // tp_waitproc()
      return
    endif
  next
  quit
RETURN

PROCEDURE dial(cString)
  local j,nWhich
  tp_waitproc( { |chunk| qqout(chunk) } )
  for j:=1 to 5
    tp_clearin()
    tp_delay(1)
    tp_send(1,"ATDT"+cString+chr(13))
    ? "Dialing..."
    nWhich=tp_waitfor(1,30,"CONNECT","BUSY","NO","ERROR")
    if nWhich==1
      // tp_waitproc()
      repeat
        ?? tp_recvto(1,chr(13),,1)
      until tp_error()==TE_TMOUT
      tp_clearin(1)
      return
    endif
    if nWhich!=4
      ? "Venter på genopkald"
      tp_delay(20)
    endif
  next
  ? "NO CONNECT from modem!"
  quit
RETURN




Leif Neland
leifn@image.dk

---
|Fidonet:  Leif Neland 2:234/49
|Internet: leifn@image.dk


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a3b_9803140954>