[asterisk-scf-commits] team/kpfleming/fosdem2011.git branch "master" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Feb 4 15:10:27 CST 2011
branch "master" has been created
at 0dbd0032333bf8bb8b03f050e522d22166138862 (commit)
- Log -----------------------------------------------------------------
commit 0dbd0032333bf8bb8b03f050e522d22166138862
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Feb 4 22:09:59 2011 +0100
Java example is now complete... at least it compiles.
diff --git a/example/HookI.java b/example/HookI.java
index 31ca168..a82cbd3 100644
--- a/example/HookI.java
+++ b/example/HookI.java
@@ -1,28 +1,31 @@
+package example;
+
import AsteriskSCF.System.Hook.V1.*;
import AsteriskSCF.SIP.ExtensionPoint.V1.*;
public class HookI extends _AuthHookDisp
{
public static Ice.ObjectAdapter _adapter;
- private Ice.Identity _id;
+ public AuthHookPrx _proxy;
public HookI()
{
- _id = new Ice.Identity();
- _id.name = Ice.Util.generateUUID();
- _adapter.add(this, _id);
- }
-
- public AuthHookPrx getProxy()
- {
- return AuthHookPrxHelper.uncheckedCast(_adapter.createProxy(_id));
+ _proxy = AuthHookPrxHelper.uncheckedCast(_adapter.addWithUUID(this));
}
public HookResult challengeRequest(RequestInfo info, DigestChallengeSeqHolder challengeSeq, Ice.Current current)
{
HookResult result = new HookResult();
+ DigestChallenge challenge = new DigestChallenge();
+
+ challenge.username = "bob";
+ challenge.password = "alice";
+ challenge.domain = new String[]{ "example.com" };
+ challenge.algorithm = DigestAlgorithm.AKAv1MD5;
+
+ challengeSeq.value = new DigestChallenge[]{ challenge };
- result.status = HookStatus.Declined;
+ result.status = HookStatus.Succeeded;
return result;
}
diff --git a/sip_hook.java b/sip_hook.java
index 62c541e..f08ad41 100644
--- a/sip_hook.java
+++ b/sip_hook.java
@@ -1,13 +1,23 @@
import example.*;
+import AsteriskSCF.System.Hook.V1.*;
+import AsteriskSCF.SIP.ExtensionPoint.V1.*;
+
public class sip_hook extends Ice.Application
{
+ private HookId _hookId;
+
public int run(String[] args)
{
- Ice.ObjectAdapter adapter = communicator().createObjectAdapter("sip-hook");
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("sip_hook");
adapter.activate();
HookI._adapter = adapter;
+ HookI hook = new HookI();
+ // this sample code does not actually locate the target SIP component
+ AuthExtensionPointPrx epPrx = AuthExtensionPointPrxHelper.uncheckedCast(communicator().stringToProxy("sip_component"));
+ _hookId = epPrx.addAuthHook(hook._proxy, new RequestType[]{ RequestType.DialogEstablishing });
communicator().waitForShutdown();
+ epPrx.removeAuthHook(_hookId);
return 0;
}
commit 8bb5ea9643d4e0b46823065f576127cfc6a7ac23
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Feb 4 18:21:28 2011 +0100
work in progress
diff --git a/Makefile b/Makefile
index a2308af..b845e72 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,14 @@
-export CLASSPATH=/home/kpfleming/git/asterisk-scf/gitall/slice/target/asterisk-scf-api.jar:/opt/Ice-3.4/lib/Ice.jar
+export CLASSPATH=/home/kpfleming/git/asterisk-scf/fosdem:/home/kpfleming/git/asterisk-scf/gitall/slice/target/asterisk-scf-api.jar:/opt/Ice-3.4/lib/Ice.jar
all: sip_hook.class
-sip_hook.class: sip_hook.java
- javac $<
+example/HookI.class: example/HookI.java
+ javac -Xlint:deprecation $<
+
+sip_hook.class: sip_hook.java example/HookI.class
+ javac -Xlint:deprecation $<
clean:
rm -rf sip_hook.class
+ rm -rf example/HookI.class
+
diff --git a/example/HookI.java b/example/HookI.java
new file mode 100644
index 0000000..31ca168
--- /dev/null
+++ b/example/HookI.java
@@ -0,0 +1,30 @@
+import AsteriskSCF.System.Hook.V1.*;
+import AsteriskSCF.SIP.ExtensionPoint.V1.*;
+
+public class HookI extends _AuthHookDisp
+{
+ public static Ice.ObjectAdapter _adapter;
+ private Ice.Identity _id;
+
+ public HookI()
+ {
+ _id = new Ice.Identity();
+ _id.name = Ice.Util.generateUUID();
+ _adapter.add(this, _id);
+ }
+
+ public AuthHookPrx getProxy()
+ {
+ return AuthHookPrxHelper.uncheckedCast(_adapter.createProxy(_id));
+ }
+
+ public HookResult challengeRequest(RequestInfo info, DigestChallengeSeqHolder challengeSeq, Ice.Current current)
+ {
+ HookResult result = new HookResult();
+
+ result.status = HookStatus.Declined;
+
+ return result;
+ }
+
+}
diff --git a/sip_hook.java b/sip_hook.java
index fee19ab..62c541e 100644
--- a/sip_hook.java
+++ b/sip_hook.java
@@ -1,4 +1,4 @@
-// import example.*;
+import example.*;
public class sip_hook extends Ice.Application
{
@@ -6,6 +6,7 @@ public class sip_hook extends Ice.Application
{
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("sip-hook");
adapter.activate();
+ HookI._adapter = adapter;
communicator().waitForShutdown();
return 0;
}
commit 51aa937151db2d657eb6fd4d1a87f47652381f5f
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Feb 4 17:38:49 2011 +0100
ignore generated Java class files
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6b468b6
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.class
commit 52b6d96a906238928e44b171d7a8701ae448b16d
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Feb 4 17:38:32 2011 +0100
beginning of example code
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a2308af
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+export CLASSPATH=/home/kpfleming/git/asterisk-scf/gitall/slice/target/asterisk-scf-api.jar:/opt/Ice-3.4/lib/Ice.jar
+
+all: sip_hook.class
+
+sip_hook.class: sip_hook.java
+ javac $<
+
+clean:
+ rm -rf sip_hook.class
diff --git a/sip_hook.java b/sip_hook.java
new file mode 100644
index 0000000..fee19ab
--- /dev/null
+++ b/sip_hook.java
@@ -0,0 +1,18 @@
+// import example.*;
+
+public class sip_hook extends Ice.Application
+{
+ public int run(String[] args)
+ {
+ Ice.ObjectAdapter adapter = communicator().createObjectAdapter("sip-hook");
+ adapter.activate();
+ communicator().waitForShutdown();
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ sip_hook app = new sip_hook();
+ System.exit(app.main("sip_hook", args));
+ }
+}
-----------------------------------------------------------------------
--
team/kpfleming/fosdem2011.git
More information about the asterisk-scf-commits
mailing list