Problemas con Realtime+SIP+Asterisk 1.4+PostgreSQL

306 views
Skip to first unread message

Dionisio Fernández Mora

unread,
Sep 15, 2008, 5:36:38 PM9/15/08
to aster...@googlegroups.com
Saludos, yo por acá nuevamente, pasa que estoy tratando de configurar
mi asterisk con realtime, creo que tengo la configuración OK ya que he
seguido los pasos de varios lugares y todos indican lo mismo.

Primero compilo el asterisk para que me soporte el res_odbc y el
res_pgsql , esto para conectarme a la base de datos en postgres, eso
pasa sin problemas y tengo todas las dependencias cubierta. El
asterisk compila bien, luego configuro el odbc para conectarse al * y
compruebo que este conectado.

laptop*CLI> odbc show
Name: asterisk-postgres
DSN: asterisk
Pooled: no>
Connected: yes

en la configuración del res_odbc.conf tengo :

[asterisk-postgres]
enabled => yes
dsn => asterisk
username => asterisk
password => ****
pre-connect => yes


y en la configuración del odbc.ini propiamente tal tengo :

[asterisk]
Description = PostgreSQL connection to 'asterisk' database
Driver = PostgreSQL1
Database = asterisk
Servername = localhost
UserName = asterisk
Password = ****
Port = 5432
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No


y el odbcinst.ini tengo :


[PostgreSQL1]
Description = PostgreSQL ODBC driver (ANSI version)
Driver = /usr/lib/odbc/psqlodbca.so
Setup = /usr/lib/odbc/libodbcpsqlS.so
Debug = 0
CommLog = 1
UsageCount = 1

[PostgreSQL2]
Description = PostgreSQL ODBC driver (Unicode version)
Driver = /usr/lib/odbc/psqlodbcw.so
Setup = /usr/lib/odbc/libodbcpsqlS.so
Debug = 0
CommLog = 1
UsageCount = 1


en la base de datos tengo las siguientes 2 tablas :

CREATE TABLE sip_table
(
id serial NOT NULL,
"name" character varying(80) NOT NULL DEFAULT ''::character varying,
host character varying(31) NOT NULL DEFAULT 'dynamic'::character varying,
nat character varying(5) NOT NULL DEFAULT 'route'::character varying,
"type" character varying(6) NOT NULL DEFAULT 'friend'::character varying,
accountcode character varying(20) DEFAULT NULL::character varying,
amaflags character varying(13) DEFAULT NULL::character varying,
callgroup character varying(10) DEFAULT NULL::character varying,
callerid character varying(80) DEFAULT NULL::character varying,
"call-limit" integer NOT NULL DEFAULT 0,
cancallforward character(3) DEFAULT 'no'::bpchar,
canreinvite character(3) DEFAULT 'no'::bpchar,
context character varying(80) DEFAULT 'default-sip'::character varying,
defaultip character varying(15) DEFAULT NULL::character varying,
dtmfmode character varying(7) DEFAULT NULL::character varying,
fromuser character varying(80) DEFAULT NULL::character varying,
fromdomain character varying(80) DEFAULT NULL::character varying,
insecure character varying(4) DEFAULT NULL::character varying,
"language" character(2) DEFAULT NULL::bpchar,
mailbox character varying(50) DEFAULT NULL::character varying,
md5secret character varying(80) DEFAULT NULL::character varying,
deny character varying(95) DEFAULT NULL::character varying,
permit character varying(95) DEFAULT NULL::character varying,
mask character varying(95) DEFAULT NULL::character varying,
musiconhold character varying(100) DEFAULT NULL::character varying,
pickupgroup character varying(10) DEFAULT NULL::character varying,
qualify character(3) DEFAULT NULL::bpchar,
regexten character varying(80) DEFAULT NULL::character varying,
restrictcid character(3) DEFAULT NULL::bpchar,
rtptimeout character(3) DEFAULT NULL::bpchar,
rtpholdtimeout character(3) DEFAULT NULL::bpchar,
secret character varying(80) DEFAULT NULL::character varying,
setvar character varying(100) DEFAULT NULL::character varying,
disallow character varying(100) DEFAULT ''::character varying,
allow character varying(100) DEFAULT ''::character varying,
fullcontact character varying(80) NOT NULL DEFAULT ''::character varying,
ipaddr character varying(15) NOT NULL DEFAULT ''::character varying,
port smallint NOT NULL DEFAULT 0::smallint,
regserver character varying(100) DEFAULT NULL::character varying,
regseconds integer NOT NULL DEFAULT 0,
username character varying(80) NOT NULL DEFAULT ''::character varying,
delay integer NOT NULL DEFAULT 0,
sortorder integer NOT NULL DEFAULT 1,
CONSTRAINT sip_table_pkey PRIMARY KEY (id),
CONSTRAINT sip_table_name_key UNIQUE (name),
CONSTRAINT sip_table_type_check CHECK (type::text = ANY
(ARRAY['user'::character varying, 'peer'::character varying,
'friend'::character varying]::text[]))
)
WITH (OIDS=FALSE);
ALTER TABLE sip_table OWNER TO asterisk;
GRANT ALL ON TABLE sip_table TO asterisk;


CREATE TABLE extensions_table
(
id serial NOT NULL,
context character varying(20) NOT NULL DEFAULT ''::character varying,
exten character varying(36) NOT NULL DEFAULT ''::character varying,
priority smallint NOT NULL DEFAULT 0::smallint,
app character varying(20) NOT NULL DEFAULT ''::character varying,
appdata character varying(128) NOT NULL DEFAULT ''::character varying,
CONSTRAINT extensions_table_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);
ALTER TABLE extensions_table OWNER TO asterisk;
GRANT ALL ON TABLE extensions_table TO asterisk;


en el extension.conf tengo :

sipusers => odbc,asterisk,sip_table
sippeers => odbc,asterisk,sip_table
extensions => odbc,asterisk,extensions_table

y en el sip.conf

[general]
rtcachefriends=yes

Aún así y siendo que tengo prácticamente todo configurado y
funcionando, ya que todo me dice OK, los usuarios SIP que tengo
agregados a la BD no salen en mi asterisk, por lo que no tengo idea
cómo hacer para que se registren contra mi asterisk.

Si alguien tiene alguna idea, de como hacer para cargar los usuarios
sip estaría muy agradecido por que ya se me acabaron las ideas.

--
Dionisio Fernández Mora aka ZeRobLaCk
http://zeroblack.blackhole.cl
zero...@linuxchillan.cl

Germán Aracil Boned

unread,
Sep 15, 2008, 7:48:59 PM9/15/08
to aster...@googlegroups.com
Por qué no usas res_pgsql directamente evitando odbc ?

Dionisio Fernández Mora escribió:

--


-
-------------------------------------
Germán Aracil Boned
Director de Sistemas
Zoon Suite S.L.

www.zoonsuite.com
963146030 - General
963146031 - Asistencia de incidencias
963146032 - FAX
-------------------------------------
-

Saúl Ibarra

unread,
Sep 16, 2008, 1:41:58 AM9/16/08
to aster...@googlegroups.com
;----------------------------------------- REALTIME SUPPORT
------------------------
; For additional information on ARA, the Asterisk Realtime Architecture,
; please read realtime.txt and extconfig.txt in the /doc directory of the
; source code.
;
;rtcachefriends=yes ; Cache realtime friends by adding
them to the internal list
; just like friends added from the
config file only on a
; as-needed basis? (yes|no)

;rtsavesysname=yes ; Save systemname in realtime database
at registration
; Default= no

;rtupdate=yes ; Send registry updates to database
using realtime? (yes|no)
; If set to yes, when a SIP UA
registers successfully, the ip address,
; the origination port, the
registration period, and the username of
; the UA will be set to database via realtime.
; If not present, defaults to 'yes'.
Note: realtime peers will
; probably not function across reloads
in the way that you expect, if
; you turn this option off.
;rtautoclear=yes ; Auto-Expire friends created on the
fly on the same schedule
; as if it had just registered?
(yes|no|<seconds>)
; If set to yes, when the registration
expires, the friend will
; vanish from the configuration until
requested again. If set
; to an integer, friends expire within
this number of seconds
; instead of the registration interval.

;ignoreregexpire=yes ; Enabling this setting has two functions:
;
; For non-realtime peers, when their
registration expires, the
; information will _not_ be removed
from memory or the Asterisk database
; if you attempt to place a call to
the peer, the existing information
; will be used in spite of it having expired
;
; For realtime peers, when the peer is
retrieved from realtime storage,
; the registration information will be
used regardless of whether
; it has expired or not; if it expires
while the realtime peer
; is still in memory (due to caching
or other reasons), the
; information will not be removed from
realtime storage


--
Saúl -- "Nunca subestimes el ancho de banda de un camión lleno de disketes."
----------------------------------------------------------------
http://www.saghul.net/

Tron

unread,
Sep 16, 2008, 3:32:59 AM9/16/08
to aster...@googlegroups.com
Cuando dices que no te aparecen, ¿a que te refieres? a que no te
aparecen cuando haces un sip show peers. Pon el rtpupdate=yes después
del rtcachefriends=yes

Dionisio Fernández Mora

unread,
Sep 15, 2008, 8:51:32 PM9/15/08
to aster...@googlegroups.com
2008/9/15 Germán Aracil Boned <ger...@tecnoxarxa.com>:

>
> Por qué no usas res_pgsql directamente evitando odbc ?

También lo configure pero fue exactamente lo mismo, al hacer el
realtime pgsql status me sale que esta conectado pero no se registran
los peers.

Preferí poner la configuración del odbc ya que esa es la que sale por
todas partes y en mismo libro de Asterisk - The Future of Telephony en
la segunda edición.

Quedo atento a sus comentarios.

Dionisio Fernández Mora

unread,
Sep 17, 2008, 11:19:53 AM9/17/08
to aster...@googlegroups.com
2008/9/16 Tron <asteri...@gmail.com>:

>
> Cuando dices que no te aparecen, ¿a que te refieres? a que no te
> aparecen cuando haces un sip show peers. Pon el rtpupdate=yes después
> del rtcachefriends=yes

Claro, a eso me refiero hago un sip show peers y no aparece nada,
tengo un ATA que se esta registrando a mi asterisk y no logra hacerlo,
aplique lo del rtpupdate=yes ya que el rtcachefriends=yes ya lo tenía
pero aún así sigue sin funcionar.

Si algún guru de ARA anda por acá, favor de indicarme en que me puedo
estar equivocando.

Tron

unread,
Sep 17, 2008, 11:59:41 AM9/17/08
to aster...@googlegroups.com
Haz un sip set debug y manda la traza cuando se intenta registrar.

Un saludo,

tron

Dionisio Fernández Mora

unread,
Sep 17, 2008, 1:02:52 PM9/17/08
to aster...@googlegroups.com
El día 17 de septiembre de 2008 11:59, Tron <asteri...@gmail.com> escribió:
>
> Haz un sip set debug y manda la traza cuando se intenta registrar.
>
> Un saludo,
>
> tron

Tron, gracias por responder, acá te envió lo que me pides :

laptop*CLI>
<--- SIP read from 192.168.1.108:5060 --->
REGISTER sip:192.168.1.107:5060 SIP/2.0
Via:SIP/2.0/UDP 192.168.1.108:5060;branch=z9hG4bK591640d60a40eda2
From: "222" <sip:2...@192.168.1.107>;tag=f9f630c5-863229
To: "222" <sip:2...@192.168.1.107>
Call-ID:D1B9-127D-468632294D52D1642826-497@SipHost
CSeq:8497 REGISTER
Contact:<sip:2...@192.168.1.108:5060>
Expires:600
Max-Forwards:70
User-Agent:056 12-38-18916925-0.10.13-SP200DS+
Content-Length:0


<------------->
--- (11 headers 0 lines) ---
Using latest REGISTER request as basis request
Sending to 192.168.1.108 : 5060 (no NAT)

<--- Transmitting (no NAT) to 192.168.1.108:5060 --->
SIP/2.0 404 Not found
Via: SIP/2.0/UDP
192.168.1.108:5060;branch=z9hG4bK591640d60a40eda2;received=192.168.1.108
From: "222" <sip:2...@192.168.1.107>;tag=f9f630c5-863229
To: "222" <sip:2...@192.168.1.107>;tag=as050026fd
Call-ID: D1B9-127D-468632294D52D1642826-497@SipHost
CSeq: 8497 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


<------------>
[Sep 17 13:00:35] NOTICE[26279]: chan_sip.c:15236
handle_request_register: Registration from '"222"
<sip:2...@192.168.1.107>' failed for '192.168.1.108' - No matching peer
found
Scheduling destruction of SIP dialog
'D1B9-127D-468632294D52D1642826-497@SipHost' in 32000 ms (Method:
REGISTER)


notece que todas las pruebas las estoy realizando en mi portatil.

Quedo atento a cualquier comentario.

Tron

unread,
Sep 18, 2008, 3:15:42 AM9/18/08
to aster...@googlegroups.com
Hola Dionsio, el error te dice claramente que no lo encuentra por lo que
esa estensión o no la tienes definida, o no tienes bien configurado el
sip. Haz la siguiente prueba. Configúrala primero dentro del sip.conf en
modo texto, una vez que la tengas hecha, define el realtime estático
definiendo el sip.conf en base de datos y si también te funciona, pasa a
realtime dinámico utilizando el sip buddies.
Reply all
Reply to author
Forward
0 new messages