powered by Jive Software

Error when use dialbyextension

server name : poy

user name : poy1

password : poy1

callee name :poy

device :SIP/poy

in extensions.conf:[/i]

static=yes

writeprotect=no

exten => s,1,Answer

exten => s,2,Background(demo-congrats)

;exten => 1,1,Playback(digits/1)

;exten => 1,2,Goto(defautl,s,1)

;exten => 2,1,Plackback(digits/2)

;exten => 2,2,Goto(default,s,1)

exten => i,1,Playback(pbx-invalid)

exten => i,2,Goto(default,s,1)

exten => t,1,Playback(vm-goodbye)

exten => t,2,Hangup()

exten => poy,1,Dial(SIP/poy)

exten => poy1,1,Dial(SIP/poy1)

in sip.conf:[/i]

context=default ; Default context for incoming calls

port=5060 ; UDP Port to bind to (SIP standard port is 5060)

bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)

srvlookup=yes ; Enable DNS SRV lookups on outbound calls

; Note: Asterisk only uses the first host

; in SRV records

; Disabling DNS SRV lookups disables the

; ability to place SIP calls based on domain

; names to some other SIP users on the Internet

type = friend

context = incoming

host = dynamic

nat = no

username = poy

secret = poy

type = friend

context = incoming

host = dynamic

nat = no

username = poy1

secret = poy1

And this is my code that i wrote.[/i]

import java.awt.event.ActionListener;

import org.jivesoftware.phone.client.BasePhoneEventListener;

import org.jivesoftware.phone.client.Call;

import org.jivesoftware.phone.client.DialedEvent;

import org.jivesoftware.phone.client.HangUpEvent;

import org.jivesoftware.phone.client.PhoneClient;

import org.jivesoftware.phone.client.PhoneEvent;

import org.jivesoftware.phone.client.PhoneEventListener;

import org.jivesoftware.phone.client.RingEvent;

import org.jivesoftware.phone.client.action.PhoneActionIQProvider;

import org.jivesoftware.phone.client.action.PhoneActionPacket;

import org.jivesoftware.phone.client.event.PhoneEventPacketExtension;

import org.jivesoftware.phone.client.event.PhoneEventPacketExtensionProvider;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.provider.ProviderManager;

import java.util.logging.Logger;

import java.util.logging.Level;

public class maintest implements PhoneEventListener{

private static final Logger log = Logger.getLogger(maintest.class.getName());

private static Call call;

private static PhoneClient client;

private static XMPPConnection conn;

static {

// XMPPConnection.DEBUG_ENABLED = true;

try {

ProviderManager.addExtensionProvider(“phone-event”,

PhoneEventPacketExtension.NAMESPACE,

new PhoneEventPacketExtensionProvider());

ProviderManager.addIQProvider(“phone-action”,

PhoneActionPacket.NAMESPACE,

new PhoneActionIQProvider());

} catch (Exception e) {

log.log(Level.SEVERE, e.getMessage(), e);

throw new ExceptionInInitializerError(e);

}

}

public void handle(PhoneEvent event) {

if(event instanceof RingEvent ) {

call = ((RingEvent) event).getCall();

}

}

public static void call(){

try {

conn = new XMPPConnection(“poy”,5222);

conn.login(“poy1”,“poy1”);

client = new PhoneClient(conn);

client.addEventListener(new BasePhoneEventListener() {

public void handleRing(RingEvent event) {

System.out.println("receiving a call from "+ event.getCallerID());

log.info("receiving a call from " + event.getCallerID());

}

public void handleDialed(DialedEvent event) {

System.out.println("You have dialed "+event.getCallID());

log.info("You have dialed "+event.getCallID());

}

public void handleHangUp(HangUpEvent event) {

System.out.println(“The phone has been hung up”);

log.info(“The phone has been hung up”);

}

});

client.dialByExtension(“poy”);

conn.close();

} catch (XMPPException e) {

System.out.println("error : "+e);

}

}

public static void main(String[] args) {

call();

System.out.println(“done”);

}

}

But when I complied, it occur error 400 and in jive server show this error :

Jan 4, 2006 3:54:12 PM org.jivesoftware.phone.asterisk.AsteriskPhoneManager dial

SEVERE: No primary channel found!

java.lang.IllegalStateException: No primary channel found!

at org.jivesoftware.phone.PhoneUser.getPrimaryDevice(PhoneUser.java:61)

at org.jivesoftware.phone.asterisk.AsteriskPhoneManager.dial(AsteriskPhoneManager. java:236)

at org.jivesoftware.phone.asterisk.AsteriskPhoneManager.dial(AsteriskPhoneManager. java:49)

at org.jivesoftware.phone.PacketHandler.handleDial(PacketHandler.java:78)

at org.jivesoftware.phone.PacketHandler.processPacket(PacketHandler.java:44)

at org.jivesoftware.phone.asterisk.AsteriskPlugin.processPacket(AsteriskPlugin.jav a:233)

at org.jivesoftware.messenger.component.InternalComponentManager$RoutableComponent .process(InternalComponentManager.java:349)

at org.jivesoftware.messenger.IQRouter.handle(IQRouter.java:183)

at org.jivesoftware.messenger.IQRouter.route(IQRouter.java:78)

at org.jivesoftware.messenger.PacketRouter.route(PacketRouter.java:65)

at org.jivesoftware.messenger.net.SocketReader.processIQ(SocketReader.java:321)

at org.jivesoftware.messenger.net.ClientSocketReader.processIQ(ClientSocketReader. java:51)

at org.jivesoftware.messenger.net.SocketReader.readStream(SocketReader.java:251)

at org.jivesoftware.messenger.net.SocketReader.run(SocketReader.java:115)

at java.lang.Thread.run(Unknown Source)

What wrong with my configuration and code.

Please correct me, if i do wrong

Have you set a primary device in the Asterisk-IM configuration for the IM user?

Just a hunch.

Dan

Have you mapped any accounts in the asterisk-im admin tool inside the messenger admin console? And if so can you paste that information?

It have to set primary device for all device?

Because i set poy to primary device.

But when I set poy1 to primary device too,it fix these error.

Is configure file(sip.conf,extensions.conf) correct?

when I called ,it doesn’'t work