[Asterisk-Dev] IAX interface with asterisk - questions about using libiax

Grzegorz Nosek blackfire at metal.art.pl
Wed Nov 12 05:18:43 MST 2003


hello all!

i'm currently developing a basic iax client and i have several
questions regarding the usage of libiax. i'd generally like to see the
big picture of registration, call setup&teardown etc. with iax. after
consulting with gnophone sources, i came with the following:

- to register as peer:
* create new iax session
* every X seconds call iax_register(the_session, server, username,
secret, X);
Q: how do i use rsa authentication? where is it specified? the client
seems to authenticate using md5/plaintext happily (methinks it uses
md5 - when supplied false password, only the md5 was logged)

- to call the * server:
* create new iax session
* iax_call(the_session, "My Caller*ID <1234>",
"user at server:/exten at context", "us", 0);
* iax_accept(the_session) or whatever, though i haven't quite got
here, because of
Q: why do i get a reject message from *? gnophone using the same
credentials (tester:tester at 10.0.0.1 if you care) receives an auth_req
message but my client seems not to and gets a plain reject instead.
both my client and gnophone register successfully (a message in *
console). and yes, i've tried with null caller*id

session setup from gnophone follows [sorry for the long copy-paste!]

[regreq/regack &c. exchanged here, between call 32721 and 88]
Tx-Frame Retry[010] -- Seqno: 00  Type: IAX     Subclass: NEW
   Timestamp: 00001ms  Callno: 32722  DCall: -0001
Tx-Frame Retry[010] -- Seqno: 01  Type: IAX     Subclass: LAGRQ
   Timestamp: 00002ms  Callno: 32722  DCall: -0001
Tx-Frame Retry[009] -- Seqno: 00  Type: IAX     Subclass: NEW
   Timestamp: 00001ms  Callno: 32722  DCall: -0001
Tx-Frame Retry[009] -- Seqno: 01  Type: IAX     Subclass: LAGRQ
   Timestamp: 00002ms  Callno: 32722  DCall: -0001
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: ACK
   Timestamp: 00001ms  Callno: 0089  DCall: 32722
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: AUTHREQ
   Timestamp: 00001ms  Callno: 0089  DCall: 32722
Tx-Frame Retry[-01] -- Seqno: 00  Type: IAX     Subclass: ACK
   Timestamp: 00001ms  Callno: 32722  DCall: 0089
Rx-Frame Retry[N/A] -- Seqno: 01  Type: IAX     Subclass: ACK
   Timestamp: 00002ms  Callno: 0089  DCall: 32722
Rx-Frame Retry[N/A] -- Seqno: 01  Type: IAX     Subclass: LAGRP
   Timestamp: 00002ms  Callno: 0089  DCall: 32722
Tx-Frame Retry[-01] -- Seqno: 01  Type: IAX     Subclass: ACK
   Timestamp: 00002ms  Callno: 32722  DCall: 0089
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: ACK
   Timestamp: 00001ms  Callno: 0089  DCall: 32722
Rx-Frame Retry[N/A] -- Seqno: 01  Type: IAX     Subclass: ACK
   Timestamp: 00002ms  Callno: 0089  DCall: 32722
Found a match!
Tx-Frame Retry[010] -- Seqno: 02  Type: IAX     Subclass: AUTHREP
   Timestamp: 00396ms  Callno: 32722  DCall: 0089
Rx-Frame Retry[N/A] -- Seqno: 02  Type: IAX     Subclass: ACK
   Timestamp: 00396ms  Callno: 0089  DCall: 32722
Rx-Frame Retry[N/A] -- Seqno: 02  Type: IAX     Subclass: ACCEPT
   Timestamp: 00367ms  Callno: 0089  DCall: 32722
Tx-Frame Retry[-01] -- Seqno: 02  Type: IAX     Subclass: ACK
   Timestamp: 00367ms  Callno: 32722  DCall: 0089
Rx-Frame Retry[N/A] -- Seqno: 03  Type: CONTROL Subclass: ANSWER
   Timestamp: 00370ms  Callno: 0089  DCall: 32722
Tx-Frame Retry[-01] -- Seqno: 03  Type: IAX     Subclass: ACK
   Timestamp: 00370ms  Callno: 32722  DCall: 0089
Rx-Frame Retry[N/A] -- Seqno: 04  Type: VOICE   Subclass: 2
   Timestamp: 00372ms  Callno: 0089  DCall: 32722
Tx-Frame Retry[-01] -- Seqno: 04  Type: IAX     Subclass: ACK
   Timestamp: 00372ms  Callno: 32722  DCall: 0089
(... and the voice goes on happily)

however, my client gets:
[after having set the session up between calls 12457 and 93]
Tx-Frame Retry[010] -- Seqno: 00  Type: IAX     Subclass: NEW
   Timestamp: 00001ms  Callno: 12458  DCall: -0001
Tx-Frame Retry[009] -- Seqno: 00  Type: IAX     Subclass: NEW
   Timestamp: 00001ms  Callno: 12458  DCall: -0001
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: ACK
   Timestamp: 00001ms  Callno: 0094  DCall: 12458
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: REJECT
   Timestamp: 00001ms  Callno: 0094  DCall: 12458
[the reason is "No authority"]
Rx-Frame Retry[N/A] -- Seqno: 00  Type: IAX     Subclass: ACK
   Timestamp: 00001ms  Callno: 0094  DCall: 12458
iax.c line 1478 in iax_find_session: No session, peer = 94, us = 12458
iax.c line 2206 in iax_net_read: No session?

iax_find_session() is supposed to create a new session (makenew==1) in
the call but only if dcall==0, which obviously it isn't. should i make
a new session beforehand? how do i get the call number? is it
guaranteed to be the old one+1 or is it simply because my * server is
otherwise idle?

and btw, where does the 12457 get from? is it random? un-initialised?

the credentials are correct (i *do* get a registration reject when i
supply false ones) and i'm kind of dumb as to why i get the reject
without an auth_req first. did i mess up something with the
registration? is the lagrq related?

my related iax.conf section:
[tester]
context=default
type=friend
host=dynamic
secret=tester
permit=0.0.0.0/0.0.0.0

i know i could retrieve most of this information from the gnophone
source, but it's quite hard for me to follow (with all passing
messages from gui to phonecore, i'm somewhat lost), so i thought i'd
ask the gurus :)

thanks very much in advance
 grzegorz nosek




More information about the asterisk-dev mailing list