@program net-ph-enc.muf 1 1000 d i lvar param lvar servport $include $lib/alynna $include $lib/tcpip $def SERVICE 10 $def ENCRYPT SERVICE "key" getlsock me @ name strdecrypt strencrypt $def DECRYPT target @ str "/_ftc/" SERVICE "/key" cat getprop tostr target @ name strdecrypt strdecrypt : dial param @ resolver ip2ref #-1 dbcmp if "Subscriber not found." "CryptPhone" pretty tellme exit then param @ resolver ip2ref str "/_ftc/" SERVICE "/key" cat getprop not if "Target has no encryption key set." "CryptPhone" pretty tellme exit then str "Attempting to call " param @ resolver "..." cat "CryptPhone" pretty tellme param @ resolver ip2ref awake? not if "No answer." "CryptPhone" pretty tellme exit then SERVICE param @ resolver 1 rpc ; : answer SERVICE "connected-to" getlsock ref2ip param ! str "Connected to (" param @ ").. Use ] to talk." cat "CryptPhone" pretty tellme SERVICE param @ 2 rpc ; : hangup SERVICE "connected-to" getlsock todbref ref2ip param ! str "Disconnecting from " param @ "..." cat "CryptPhone" pretty tellme SERVICE param @ 3 rpc str "Disconnected. " cat "CryptPhone" pretty tellme ; : request-event var dest var port port ! dest ! dest @ str me @ "(" me @ ref2ip ") is calling you. Use +phs/answer to answer the call." cat "CryptPhone" pretty ansi_notify ; PUBLIC request-event : connect-event var dest var port var handle port ! dest ! handle ! dest @ str me @ "(" me @ ref2ip ") has answered. Use ] to talk." cat "CryptPhone" pretty ansi_notify ; PUBLIC connect-event : close-event var dest var port port ! dest ! dest @ str me @ "(" me @ ref2ip ") hung up." cat "CryptPhone" pretty ansi_notify ; PUBLIC close-event : rpc-event var port var dest port ! dest ! ; PUBLIC rpc-event : recvsock var handle var target param @ toint handle ! handle @ them target ! handle @ them handle @ "buffer" getsock DECRYPT me @ name pretty ansi_notify ; : talk var handle SERVICE "handle" getlsock toint handle ! param @ ENCRYPT handle @ sendsock param @ me @ name pretty tellme ; : setpw SERVICE "key" param @ me @ name strencrypt setlsock "Crypt key set." "CryptPhone" pretty tellme ; : main param ! command @ "{+phs/call|+phs/dial}" smatch if dial exit then command @ "+phs/answer" smatch if answer exit then command @ "+phs/hangup" smatch if hangup exit then command @ "+phs/key" smatch if setpw exit then command @ "]" smatch if talk exit then recvsock ; . c q